/* ==========================================================================
   IDMBX - Modern Mailbox & Admin Dashboard Stylesheet
   Tandem Warm Editorial Bento Design System
   ========================================================================== */

:root,
body.theme-dark {
  --font-family: "Plus Jakarta Sans", 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;

  /* Tandem Dark Espresso Palette */
  --page: #14110e;
  --side: #14110e;
  --column: #1b1713;
  --qcard: #221d18;
  --card: #241e19e0;
  --card-solid: #241e19;
  --sunk: #2c251f;
  --hair: #332b24;
  --hair-strong: #453a31;
  --ink: #f3ece5;
  --muted: #c4b7aa;
  --faint: #ad9f92;
  --hl: #4a2615;
  --hl-ink: #ffd2b8;
  --brand: #ff8a5c;
  --brand-2: #e0673a;
  --brand-text: #ffa27c;
  --tick-off: #3a3029;
  --act: #f3ece5;
  --on-act: #14110e;
  --good: #6fd29c;
  --good-bg: #173023;
  --bad: #f4908a;
  --bad-bg: #3b1d1e;
  --hot: #ffab85;
  --hot-bg: #44241a;
  --warm: #f2c063;
  --warm-bg: #3a2c10;
  --cold: #9cc0ff;
  --cold-bg: #1a2a45;
  --wash: radial-gradient(70% 60% at 0% 0%, #ff8a5c24 0%, #ff8a5c00 70%),
          radial-gradient(60% 55% at 100% 0%, #f2c06312 0%, #f2c06300 70%),
          radial-gradient(70% 50% at 70% 100%, #78be960f 0%, #78be9600 70%),
          #1a1612;

  /* Mapped Legacy Variables */
  --bg-main: var(--page);
  --bg-panel: var(--column);
  --bg-card: var(--card-solid);
  --bg-secondary: var(--card-solid);
  --bg-surface: var(--column);
  --bg-hover: rgba(243, 236, 229, 0.06);
  --bg-active: var(--hl);
  --bg-input: var(--sunk);
  --border-color: var(--hair);
  --border-focus: var(--brand);

  --text-main: var(--ink);
  --text-primary: var(--ink);
  --text-muted: var(--muted);
  --text-secondary: var(--muted);
  --text-dim: var(--faint);

  --primary: var(--brand);
  --primary-hover: var(--brand-2);
  --primary-glow: rgba(255, 138, 92, 0.3);
  --accent: var(--brand-2);

  --success: var(--good);
  --warning: var(--warm);
  --danger: var(--bad);
  --info: var(--cold);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-card: none;
  --shadow-pop: 0 0 0 1px var(--hair-strong), 0 24px 60px -18px #000000b3;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px -12px rgba(0, 0, 0, 0.45);
  --shadow-lg: var(--shadow-pop);
  --shadow-glass: none;
  --scrim: #0000008c;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tandem Light Warm Editorial Mode */
body.theme-light {
  color-scheme: light;

  --page: #efebe6;
  --side: #efebe6;
  --column: #f6f3ef;
  --qcard: #fdfbf8;
  --card: #fdfbf8d6;
  --card-solid: #fdfbf8;
  --sunk: #f3efe9;
  --hair: #e4ded6;
  --hair-strong: #d1c9be;
  --ink: #221a14;
  --muted: #54493f;
  --faint: #6a5e53;
  --hl: #ffdcc6;
  --hl-ink: #7a2c0c;
  --brand: #b84a23;
  --brand-2: #9c3b18;
  --brand-text: #9c3b18;
  --tick-off: #e6ddd3;
  --act: #221a14;
  --on-act: #fdfbf8;
  --good: #1d6b45;
  --good-bg: #dcefe3;
  --bad: #a8322e;
  --bad-bg: #f8e1df;
  --hot: #a33a12;
  --hot-bg: #ffe1d1;
  --warm: #845200;
  --warm-bg: #faecc9;
  --cold: #24569e;
  --cold-bg: #dde9fb;
  --wash: radial-gradient(70% 60% at 0% 0%, #ffd9c2 0%, #ffd9c200 70%),
          radial-gradient(60% 55% at 100% 0%, #fbecc4 0%, #fbecc400 70%),
          radial-gradient(70% 50% at 70% 100%, #dcebdf 0%, #dcebdf00 70%),
          #f9f6f2;

  --bg-main: var(--page);
  --bg-panel: var(--column);
  --bg-card: var(--card-solid);
  --bg-secondary: var(--card-solid);
  --bg-surface: var(--column);
  --bg-hover: rgba(34, 26, 20, 0.045);
  --bg-active: var(--hl);
  --bg-input: var(--sunk);
  --border-color: var(--hair);
  --border-focus: var(--brand);

  --text-main: var(--ink);
  --text-primary: var(--ink);
  --text-muted: var(--muted);
  --text-secondary: var(--muted);
  --text-dim: var(--faint);

  --primary: var(--brand);
  --primary-hover: var(--brand-2);
  --primary-glow: rgba(184, 74, 35, 0.2);
  --accent: var(--brand-2);

  --success: var(--good);
  --warning: var(--warm);
  --danger: var(--bad);
  --info: var(--cold);

  --shadow-card: 0 1px 2px #221a140a, 0 8px 24px -16px #221a1424;
  --shadow-pop: 0 0 0 1px var(--hair), 0 24px 60px -18px #221a144d;
  --shadow-sm: var(--shadow-card);
  --shadow-md: 0 8px 24px -14px rgba(34, 26, 20, 0.14);
  --shadow-lg: var(--shadow-pop);
  --shadow-glass: var(--shadow-card);
  --scrim: #1a120c6b;
}

/* Dynamic Theme Accents (Adapted for both Light & Dark Tandem modes) */
body.accent-tandem {
  --welcome-gradient: linear-gradient(135deg, rgba(184, 74, 35, 0.9) 0%, rgba(90, 32, 12, 0.96) 100%);
}

body.accent-blue {
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-text: #2563eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.25);
  --accent: #3b82f6;
  --border-focus: #2563eb;
  --hl: #dbeafe;
  --hl-ink: #1e3a8a;
  --welcome-gradient: linear-gradient(135deg, rgba(37, 99, 235, 0.88) 0%, rgba(30, 27, 75, 0.95) 100%);
}
body.theme-dark.accent-blue {
  --brand: #60a5fa;
  --brand-2: #3b82f6;
  --brand-text: #93c5fd;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --hl: #1e3a5f;
  --hl-ink: #bfdbfe;
}

body.accent-emerald {
  --brand: #059669;
  --brand-2: #047857;
  --brand-text: #047857;
  --primary: #059669;
  --primary-hover: #047857;
  --primary-glow: rgba(16, 185, 129, 0.25);
  --accent: #10b981;
  --border-focus: #059669;
  --hl: #d1fae5;
  --hl-ink: #064e3b;
  --welcome-gradient: linear-gradient(135deg, rgba(16, 185, 129, 0.88) 0%, rgba(6, 78, 59, 0.95) 100%);
}
body.theme-dark.accent-emerald {
  --brand: #34d399;
  --brand-2: #10b981;
  --brand-text: #6ee7b7;
  --primary: #10b981;
  --primary-hover: #059669;
  --hl: #133829;
  --hl-ink: #a7f3d0;
}

body.accent-purple {
  --brand: #7c3aed;
  --brand-2: #6d28d9;
  --brand-text: #6d28d9;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-glow: rgba(139, 92, 246, 0.25);
  --accent: #8b5cf6;
  --border-focus: #7c3aed;
  --hl: #ede9fe;
  --hl-ink: #4c1d95;
  --welcome-gradient: linear-gradient(135deg, rgba(139, 92, 246, 0.88) 0%, rgba(76, 29, 149, 0.95) 100%);
}
body.theme-dark.accent-purple {
  --brand: #a78bfa;
  --brand-2: #8b5cf6;
  --brand-text: #c4b5fd;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --hl: #2e1d4a;
  --hl-ink: #ddd6fe;
}

body.accent-amber {
  --brand: #d97706;
  --brand-2: #b45309;
  --brand-text: #b45309;
  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-glow: rgba(245, 158, 11, 0.25);
  --accent: #f59e0b;
  --border-focus: #d97706;
  --hl: #fef3c7;
  --hl-ink: #78350f;
  --welcome-gradient: linear-gradient(135deg, rgba(245, 158, 11, 0.88) 0%, rgba(120, 53, 15, 0.95) 100%);
}
body.theme-dark.accent-amber {
  --brand: #fbbf24;
  --brand-2: #f59e0b;
  --brand-text: #fcd34d;
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --hl: #3d290c;
  --hl-ink: #fde68a;
}

body.accent-cyan {
  --brand: #0891b2;
  --brand-2: #0e7490;
  --brand-text: #0e7490;
  --primary: #0891b2;
  --primary-hover: #0e7490;
  --primary-glow: rgba(6, 182, 212, 0.25);
  --accent: #06b6d4;
  --border-focus: #0891b2;
  --hl: #cffafe;
  --hl-ink: #164e63;
  --welcome-gradient: linear-gradient(135deg, rgba(6, 182, 212, 0.88) 0%, rgba(22, 78, 99, 0.95) 100%);
}
body.theme-dark.accent-cyan {
  --brand: #22d3ee;
  --brand-2: #06b6d4;
  --brand-text: #67e8f9;
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --hl: #12343d;
  --hl-ink: #a5f3fc;
}

body.accent-rose {
  --brand: #e11d48;
  --brand-2: #be123c;
  --brand-text: #be123c;
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-glow: rgba(244, 63, 94, 0.25);
  --accent: #f43f5e;
  --border-focus: #e11d48;
  --hl: #ffe4e6;
  --hl-ink: #881337;
  --welcome-gradient: linear-gradient(135deg, rgba(244, 63, 94, 0.88) 0%, rgba(136, 19, 55, 0.95) 100%);
}
body.theme-dark.accent-rose {
  --brand: #fb7185;
  --brand-2: #f43f5e;
  --brand-text: #fda4af;
  --primary: #f43f5e;
  --primary-hover: #e11d48;
  --hl: #421623;
  --hl-ink: #fecdd3;
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  background-color: var(--page);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--hair-strong) transparent;
}

#app {
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.glass-panel {
  background: var(--card);
  border: 1px solid var(--hair);
  box-shadow: var(--shadow-card);
}

/* Screens */
.view-screen {
  display: none;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.view-screen.active {
  display: flex;
}

#main-view.active {
  display: flex;
  flex-direction: column;
}

.logo-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-img-wrapper {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo-main {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.4));
  border-radius: var(--radius-md);
}

.brand-logo-nav {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(59, 130, 246, 0.3));
  border-radius: 6px;
  flex-shrink: 0;
}

.logo-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 16px var(--primary-glow);
}

.logo-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

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

.gateway-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

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

.status-dot.pulsing {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

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

/* ==========================================================================
   LOGIN PAGE — LUXURY DARK GLASSMORPHISM & 3D GEOMETRIC ANIMATION
   ========================================================================== */

#login-view {
  position: relative !important;
  overflow: hidden !important;
  display: none;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  background-color: #080a0f !important;
}

#login-view.active {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
}

/* --- 3D Geometric Dark Background & Dynamic Lighting --- */
#login-view .login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

#login-view .login-bg-image {
  position: absolute;
  inset: -20px;
  background: url('/images/login-bg-geom.jpg') no-repeat center center / cover;
  filter: brightness(0.85) contrast(1.15) saturate(0.9);
  transform: scale(1.02);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#login-view .login-bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(10, 12, 16, 0.15) 0%, rgba(5, 7, 10, 0.88) 100%);
}

#login-view .login-mouse-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, rgba(59, 130, 246, 0.03) 40%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  will-change: left, top;
}

/* Soft drifting color blobs */
#login-view .aurora {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  will-change: transform;
}
#login-view .aurora-1 {
  width: 500px; height: 500px;
  top: -150px; left: -100px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.35), transparent 70%);
  animation: aurora-float-1 20s ease-in-out infinite;
}
#login-view .aurora-2 {
  width: 440px; height: 440px;
  bottom: -150px; right: -80px;
  background: radial-gradient(circle, rgba(147, 197, 253, 0.25), transparent 70%);
  animation: aurora-float-2 24s ease-in-out infinite;
}
#login-view .aurora-3 {
  width: 360px; height: 360px;
  top: 35%; left: 60%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
  animation: aurora-float-3 28s ease-in-out infinite;
}

@keyframes aurora-float-1 {
  0%,100% { transform: translate(0, 0) scale(1); }
  50%     { transform: translate(50px, 30px) scale(1.1); }
}
@keyframes aurora-float-2 {
  0%,100% { transform: translate(0, 0) scale(1); }
  50%     { transform: translate(-40px, -25px) scale(1.08); }
}
@keyframes aurora-float-3 {
  0%,100% { transform: translate(-50%, -50%) scale(1); opacity: 0.15; }
  50%     { transform: translate(-45%, -55%) scale(1.15); opacity: 0.3; }
}

/* --- 3D Perspective Stage & Central Floating Glass Card --- */
#login-view .login-stage {
  position: relative;
  z-index: 2;
  perspective: 1400px;
  width: 100%;
  max-width: 820px;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#login-view .login-dual-card {
  position: relative;
  width: 100% !important;
  max-width: 820px !important;
  min-height: 460px !important;
  border-radius: 28px !important;
  background: rgba(30, 35, 43, 0.6) !important;
  backdrop-filter: blur(28px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow:
    0 40px 90px -15px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 0 30px 0 rgba(255, 255, 255, 0.02) !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  overflow: hidden !important;
  padding: 0 !important;
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.3s ease;
  animation: login-card-enter 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes login-card-enter {
  0% { opacity: 0; transform: translateY(32px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

#login-view .card-glare-effect {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.07), transparent 45%);
  z-index: 5;
  mix-blend-mode: overlay;
}

/* --- Panel Layouts --- */
#login-view .login-side-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 2;
}

#login-view .login-pane-signin {
  flex: 1 1 50% !important;
  min-width: 0 !important;
  padding: 44px 44px !important;
  z-index: 3 !important;
}

#login-view .login-pane-welcome {
  flex: 1 1 50% !important;
  min-width: 0 !important;
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  padding: 44px 40px 44px 50px !important;
  overflow: hidden !important;
  z-index: 2 !important;
}

/* Slanted glass divider overlay */
#login-view .slant-glass-layer {
  position: absolute;
  inset: 0;
  clip-path: polygon(14% 0, 100% 0, 100% 100%, 0% 100%);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.01) 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 1px 0 0 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

/* --- Form & Typography Styling (Matching Reference Image) --- */
#login-view .login-heading-main {
  font-size: 34px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  margin: 0 0 28px 0 !important;
  letter-spacing: -0.5px !important;
}

/* Underline style inputs */
#login-view .input-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 0 !important;
  margin-bottom: 22px !important;
  padding: 6px 0 !important;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#login-view .input-field-wrap:focus-within {
  border-bottom-color: #ffffff !important;
  box-shadow: 0 1px 0 0 #ffffff !important;
}

#login-view .input-icon-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px 0 2px;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.25s ease;
}

#login-view .input-field-wrap:focus-within .input-icon-slot {
  color: #ffffff;
}

#login-view .input-field-wrap input,
#login-view .input-field-wrap input[type="text"],
#login-view .input-field-wrap input[type="password"],
#login-view .luxury-input {
  width: 100% !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 14.5px !important;
  font-family: inherit !important;
  font-weight: 400 !important;
  padding: 6px 0 !important;
  caret-color: #ffffff !important;
  border-radius: 0 !important;
}

#login-view .luxury-input::placeholder {
  color: rgba(255, 255, 255, 0.38) !important;
  font-weight: 400 !important;
}

/* Chrome/Browser Autofill reset */
#login-view input:-webkit-autofill,
#login-view input:-webkit-autofill:hover,
#login-view input:-webkit-autofill:focus,
#login-view input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #1a1e26 inset !important;
  -webkit-text-fill-color: #ffffff !important;
  transition: background-color 5000s ease-in-out 0s;
  caret-color: #ffffff !important;
}

#login-view .btn-toggle-eye {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  color: rgba(255, 255, 255, 0.45) !important;
  cursor: pointer;
  padding: 0 6px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
}

#login-view .btn-toggle-eye:hover {
  color: #ffffff !important;
  transform: scale(1.1);
}

/* Luxury Action Button (Pill shaped with smooth glass glow) */
#login-view .btn-luxury-action {
  width: 100% !important;
  height: 44px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%) !important;
  color: #ffffff !important;
  font-family: inherit !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.3px !important;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  margin-top: 10px !important;
  margin-bottom: 22px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

#login-view .btn-luxury-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-25deg);
  transition: 0.6s;
}

#login-view .btn-luxury-action:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 100%) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-1.5px);
}

#login-view .btn-luxury-action:hover::before {
  left: 140%;
}

#login-view .btn-luxury-action:active {
  transform: translateY(1px) scale(0.99);
}

/* While submitting */
#login-view .btn-luxury-action.is-loading {
  pointer-events: none;
}
#login-view .btn-luxury-action.is-loading span {
  opacity: 0;
}
#login-view .btn-luxury-action.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

/* Links below Login */
#login-view .login-action-sublinks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#login-view .signup-callout {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

#login-view .link-luxury {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0 4px;
  transition: opacity 0.2s ease, text-shadow 0.2s ease;
}

#login-view .link-luxury:hover {
  opacity: 0.85;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#login-view .link-subtle {
  background: transparent;
  border: none;
  outline: none;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  padding: 2px 6px;
  transition: color 0.2s ease;
}

#login-view .link-subtle:hover {
  color: rgba(255, 255, 255, 0.85);
}

/* --- Right Panel: Welcome Hero (HELLO, FRIEND!) --- */
#login-view .welcome-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

#login-view .welcome-hero-title {
  font-size: 42px !important;
  line-height: 1.1 !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  color: #ffffff !important;
  letter-spacing: -0.5px !important;
  margin: 0 0 18px 0 !important;
}

#login-view .welcome-hero-desc {
  font-size: 14.5px !important;
  line-height: 1.6 !important;
  color: rgba(255, 255, 255, 0.68) !important;
  max-width: 270px !important;
  margin: 0 0 32px 0 !important;
}

#login-view .btn-luxury-outline {
  align-self: flex-start;
  padding: 12px 28px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(8px) !important;
  color: #ffffff !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
}

#login-view .btn-luxury-outline:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: rgba(255, 255, 255, 0.55) !important;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-1.5px);
}

/* Tactile Shake on Error */
#login-view .login-card.login-error-shake {
  animation: login-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes login-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

/* Modals */
.luxury-modal-card {
  max-width: 480px;
  border-radius: 20px;
  background: rgba(24, 28, 35, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
}

.signup-feature-pills {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
}

.feature-pill-item {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  border-radius: 12px;
}

.signup-admin-box {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 12px;
  text-align: center;
}

.signup-admin-box small {
  display: block;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
}

.signup-admin-box strong {
  color: #93c5fd;
  font-size: 13px;
}

.code-terminal-snippet {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: monospace;
  color: #38bdf8;
  font-size: 13px;
  margin-top: 10px;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
  #login-view .login-dual-card {
    flex-direction: column !important;
    min-height: auto !important;
    max-width: 400px !important;
  }
  #login-view .login-pane-welcome {
    display: none !important;
  }
  #login-view .login-pane-signin {
    padding: 36px 28px !important;
  }
}

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

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.compact-label {
  width: 60px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
}

.field-hint {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--text-dim);
}

.btn-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: var(--danger);
}

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

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-icon-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon-sm:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
}

.btn-compose {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  letter-spacing: 0.3px;
}

.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
}

.alert-box.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.login-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}

/* Navbar */
.navbar {
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  z-index: 50;
}

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

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

.brand-icon {
  color: var(--primary);
}

.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.nav-center {
  flex: 1;
  max-width: 540px;
  margin: 0 24px;
}

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

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input-wrapper input {
  padding-left: 38px;
  padding-right: 32px;
  height: 38px;
  border-radius: 20px;
  background: var(--bg-input);
}

.search-input-wrapper .btn-icon-sm {
  position: absolute;
  right: 8px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.view-switchers {
  display: flex;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.btn-tab {
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
}

.btn-tab.active {
  background: var(--primary);
  color: #ffffff;
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--border-color);
}

.user-avatar, .sender-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-display-name {
  font-weight: 600;
  font-size: 13px;
}

.user-display-email {
  font-size: 11px;
  color: var(--text-dim);
}

/* Layout Body */
.layout-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.app-section {
  display: none;
  width: 100%;
  height: 100%;
}

.app-section.active {
  display: flex;
}

/* Webmail & App Sidebar */
.sidebar {
  width: 250px;
  min-width: 250px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              border-color 0.2s ease;
  white-space: nowrap;
}

/* Collapsed Sidebar: Icon-Only Rail */
.sidebar.collapsed {
  width: 68px !important;
  min-width: 68px !important;
  max-width: 68px !important;
  padding: 14px 6px !important;
  overflow-x: hidden !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
  align-items: center;
}

.sidebar.collapsed .sidebar-top {
  margin-bottom: 14px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.sidebar.collapsed .btn-compose {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0 !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  flex-shrink: 0;
}

.sidebar.collapsed .btn-compose span {
  display: none !important;
}

.sidebar.collapsed .btn-compose svg {
  margin: 0 !important;
  width: 20px;
  height: 20px;
}

.sidebar.collapsed .sidebar-menu {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-label-row,
.sidebar.collapsed #admin-sidebar-badge,
.sidebar.collapsed .no-custom-folders-item {
  display: none !important;
}

.sidebar.collapsed #custom-folder-list {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  width: 100%;
}

.sidebar.collapsed .nav-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.sidebar.collapsed .nav-item {
  width: 44px;
  height: 44px;
  padding: 0 !important;
  margin: 0 auto;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  position: relative;
  box-shadow: none !important;
}

.sidebar.collapsed .nav-item.active {
  background: var(--bg-active);
  box-shadow: none !important;
}

.sidebar.collapsed .nav-item.active .nav-icon-box {
  background: rgba(59, 130, 246, 0.2);
}

.sidebar.collapsed .nav-text-group,
.sidebar.collapsed .folder-total-count,
.sidebar.collapsed .folder-action-btn,
.sidebar.collapsed .notes-tags-list,
.sidebar.collapsed .calendar-sidebar-events,
.sidebar.collapsed .files-category-list,
.sidebar.collapsed .task-progress-summary,
.sidebar.collapsed .badge:not(.badge-unread) {
  display: none !important;
}

.sidebar.collapsed .nav-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar.collapsed .nav-item .badge-unread {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.sidebar.collapsed .sidebar-bottom {
  display: none !important;
}

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

.sidebar-top {
  margin-bottom: 20px;
}

.menu-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 0 10px 8px;
  font-weight: 700;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  font-size: 13px;
  position: relative;
}

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

.nav-item.active {
  background: var(--bg-active);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.nav-text-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  text-align: left;
  overflow: hidden;
}

.nav-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.2;
}

.nav-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.2;
}

.folder-total-count {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: auto;
  font-weight: 500;
}

.nav-item .badge {
  margin-left: auto;
}

.badge {
  background: var(--bg-hover);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-unread {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 8px var(--primary-glow);
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.quota-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quota-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}

.quota-bar-wrapper {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.4s ease;
}

/* Mail List Pane */
.mail-list-pane {
  width: 380px;
  border-right: 1px solid var(--border-color);
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.pane-header {
  height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

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

.header-left h2 {
  font-size: 16px;
  font-weight: 700;
}

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

.mail-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  gap: 12px;
  position: relative;
}

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

.mail-item.selected {
  background: var(--bg-active);
  border-left: 3px solid var(--primary);
}

.mail-item.unread {
  background: rgba(59, 130, 246, 0.05);
}

.mail-item.unread .mail-sender,
.mail-item.unread .mail-subject-row {
  font-weight: 700;
  color: var(--text-main);
}

.mail-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.mail-sender {
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

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

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

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

/* Mail Detail Pane */
.mail-detail-pane {
  flex: 1;
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.empty-state {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  gap: 12px;
  padding: 40px;
  text-align: center;
}

.empty-state.active {
  display: flex;
}

.detail-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-toolbar {
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-header-card {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.mail-subject {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sender-info {
  flex: 1;
}

.from-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.email-subtext {
  color: var(--text-dim);
  font-size: 12px;
}

.to-line {
  font-size: 12px;
  color: var(--text-muted);
}

.date-badge {
  font-size: 12px;
  color: var(--text-dim);
}

.attachments-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.attach-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

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

.attachment-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.attachment-item-card:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.attachment-item-card.threat-detected {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.att-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.att-card-icon {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

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

.att-card-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.att-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.meta-dot {
  opacity: 0.5;
}

.att-security-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
}

.att-security-badge.badge-clean {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.att-security-badge.badge-virus {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: pulse-danger 1.5s infinite;
}

@keyframes pulse-danger {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

.att-security-badge.badge-scanned {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

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

.btn-att-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-panel);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

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

.btn-att-download:hover {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.mail-body-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background: var(--bg-main);
  padding: 16px 20px;
}

.mail-paper-canvas {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  min-height: 250px;
}

.mail-paper-canvas.canvas-light {
  background: #ffffff !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
}

.mail-paper-canvas.canvas-light .text-body-view {
  color: #0f172a !important;
}

.mail-paper-canvas.canvas-light .text-body-view blockquote,
.mail-paper-canvas.canvas-light .quote-line {
  color: #475569 !important;
  background: #f8fafc !important;
  border-left-color: #3b82f6 !important;
}

#detail-body-frame {
  width: 100%;
  min-height: 250px;
  border: none;
  background: transparent;
  display: block;
}

.text-body-view {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-main);
  word-break: break-word;
}

.text-body-view blockquote,
.quote-line {
  border-left: 3px solid var(--primary);
  padding-left: 14px;
  margin: 12px 0;
  color: var(--text-muted);
  font-style: normal;
  background: rgba(59, 130, 246, 0.06);
  padding-top: 6px;
  padding-bottom: 6px;
  border-radius: 0 6px 6px 0;
}

/* WYSIWYG Editor */
.wysiwyg-wrapper {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  overflow: hidden;
  transition: var(--transition);
}

.wysiwyg-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.wysiwyg-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  user-select: none;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 6px;
  margin-right: 6px;
  border-right: 1px solid var(--border-color);
}

.toolbar-group:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

.tb-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.tb-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.tb-btn:active {
  background: var(--bg-active);
  color: var(--primary);
}

.tb-select {
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  height: 30px;
  outline: none;
  cursor: pointer;
}

.wysiwyg-editor {
  min-height: 220px;
  max-height: 480px;
  overflow-y: auto;
  padding: 16px;
  outline: none;
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.6;
}

.wysiwyg-editor[placeholder]:empty:before {
  content: attr(placeholder);
  color: var(--text-dim);
  pointer-events: none;
}

.wysiwyg-editor blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
  margin: 10px 0;
  color: var(--text-dim);
}

.wysiwyg-editor a {
  color: var(--primary);
  text-decoration: underline;
}

.wysiwyg-editor ul, .wysiwyg-editor ol {
  padding-left: 24px;
  margin: 8px 0;
}

.raw-box {
  background: #000000;
  color: #38bdf8;
  padding: 16px;
  font-family: monospace;
  font-size: 12px;
  max-height: 250px;
  overflow-y: auto;
  border-bottom: 1px solid var(--border-color);
}

/* Admin Dashboard Pane */
.admin-sidebar {
  width: 250px;
  min-width: 250px;
}

.admin-content-pane {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

.mail-pager {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
  user-select: none;
}
.mail-pager.hidden { display: none; }
.mail-pager .btn-icon:disabled { opacity: 0.35; cursor: default; }

.mail-category-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
  scrollbar-width: none;
}
.mail-category-tabs.hidden { display: none; }
.mail-category-tabs::-webkit-scrollbar { display: none; }
.mail-cat-tab {
  flex: 1 0 auto;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.mail-cat-tab:hover { background: rgba(148, 163, 184, 0.1); }
.mail-cat-tab.active { color: #3b82f6; border-bottom-color: #3b82f6; }
.mail-cat-tab .cat-unread {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #3b82f6;
  color: #fff;
  font-size: 10.5px;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

.page-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title-bar h2 {
  font-size: 22px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.stat-footer {
  font-size: 12px;
  color: var(--text-dim);
}

.admin-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.card {
  padding: 22px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Admin Search & Filter Toolbar */
.admin-filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  flex-wrap: wrap;
}

.admin-filter-toolbar .search-box {
  position: relative;
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  align-items: center;
}

.admin-filter-toolbar .search-box svg.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.admin-filter-toolbar .search-box input {
  width: 100%;
  height: 38px;
  padding-left: 36px;
  padding-right: 36px;
  box-sizing: border-box;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
}

.admin-filter-toolbar .search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.admin-filter-toolbar .search-clear-btn {
  position: absolute;
  right: 8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}

.admin-filter-toolbar .search-clear-btn.hidden {
  display: none;
}

.admin-filter-toolbar .search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-main);
}

.admin-filter-toolbar .filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 1 auto;
}

.admin-filter-toolbar .filter-select {
  height: 38px;
  min-width: 130px;
  padding: 0 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.admin-filter-toolbar .filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.admin-filter-toolbar .results-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-input);
  height: 38px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .admin-filter-toolbar .filter-group { width: 100%; }
  .admin-filter-toolbar .filter-select { flex: 1 1 130px; }
}

.table-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 12px 16px;
  background: var(--bg-card);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.result-box {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.ssl-layout-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
}

.ssl-info-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

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

.info-row .value {
  font-weight: 600;
}

.log-box {
  background: #000000;
  color: #10b981;
  padding: 14px;
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.architecture-flow {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  margin: 10px 0;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.flow-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.flow-arrow {
  font-size: 24px;
  color: var(--primary);
}

.idmg-details-box {
  background: var(--bg-input);
  padding: 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.idmg-details-box ul {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card.modal-lg {
  max-width: 760px;
}

@keyframes modal-slide-in {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.compose-editor-wrapper textarea {
  resize: vertical;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
}

/* ==========================================================================
   Gmail-Style Floating / Docked Compose Window
   ========================================================================== */
.compose-window {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 580px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 50px);
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  z-index: 90;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s ease,
              border-radius 0.2s ease;
  overflow: hidden;
}

body.theme-light .compose-window {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.compose-window.hidden {
  display: none !important;
}

/* Header */
.compose-header {
  padding: 10px 14px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  height: 42px;
  transition: background 0.2s ease;
}

body.theme-light .compose-header {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.compose-header:hover {
  background: #243248;
}

body.theme-light .compose-header:hover {
  background: #e2e8f0;
}

.compose-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
}

.compose-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.compose-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  flex-shrink: 0;
}

.compose-ctrl-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.compose-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

body.theme-light .compose-ctrl-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

/* Minimized State */
.compose-window.minimized {
  height: 42px !important;
  width: 280px !important;
  max-width: calc(100vw - 32px);
  border-radius: 10px 10px 0 0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.compose-window.minimized #compose-form {
  display: none !important;
}

.compose-window.minimized .compose-header {
  border-bottom: none;
}

/* Maximized State */
.compose-window.maximized {
  top: 50% !important;
  left: 50% !important;
  bottom: auto !important;
  right: auto !important;
  transform: translate(-50%, -50%) !important;
  width: 90vw !important;
  max-width: 980px !important;
  height: 86vh !important;
  max-height: 86vh !important;
  border-radius: 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.7) !important;
  z-index: 150 !important;
}

body.theme-light .compose-window.maximized {
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22) !important;
}

/* Form structure within compose window */
.compose-window #compose-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.compose-window #compose-form .modal-body {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.compose-window #compose-form .modal-footer,
.compose-modal-footer {
  padding: 10px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 10px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.compose-from-select {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.compose-from-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

body.theme-light .compose-from-select {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

body.theme-light .compose-from-select option {
  background: #ffffff;
  color: #0f172a;
}

.compose-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.compose-send-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff !important;
  border: none;
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1;
}

.compose-send-btn:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.compose-send-btn:active {
  transform: translateY(0);
}

.compose-footer-sep {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}

.compose-footer-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.compose-footer-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-color);
}

.compose-footer-icon-btn.compose-discard-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.25);
}

.compose-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.compose-draft-status {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.compose-save-draft-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}

.compose-save-draft-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

body.theme-light .compose-send-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff !important;
}

body.theme-light .compose-save-draft-btn {
  border-color: #cbd5e1;
  color: #334155;
  background: #ffffff;
}

body.theme-light .compose-save-draft-btn:hover {
  background: #f8fafc;
  border-color: var(--primary);
  color: var(--primary);
}

body.theme-light .compose-footer-icon-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.compose-window #compose-form .wysiwyg-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 180px;
}

.compose-window.maximized #compose-form .wysiwyg-wrapper {
  flex: 1;
}

.compose-window.maximized #compose-form .wysiwyg-editor {
  min-height: 300px;
  max-height: none;
  flex: 1;
}

.compose-window:not(.maximized) #compose-form .wysiwyg-editor {
  min-height: 160px;
  max-height: 280px;
  flex: 1;
}

@media (max-width: 768px) {
  .compose-window {
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;          /* 100% avoids the 100vw scrollbar overflow that forced zoom-out */
    max-width: 100% !important;
    bottom: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
  }
  .compose-window.minimized {
    right: 12px !important;
    left: auto !important;
    width: 220px !important;
    max-width: calc(100% - 24px) !important;
    height: 42px !important;
    border-radius: 10px 10px 0 0 !important;
  }
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1200;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease;
}

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

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin-icon {
  animation: spin 0.9s linear infinite;
  transform-origin: center;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-dim);
}

/* Spam Alert Banner & Actions */
.spam-alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin: 16px 24px 0 24px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(245, 158, 11, 0.08) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.08);
  animation: banner-slide-down 0.25s ease-out;
}

@keyframes banner-slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.spam-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.spam-banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  flex-shrink: 0;
}

.spam-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spam-banner-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #f87171;
}

.spam-banner-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-spam-to-inbox {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
  font-weight: 600;
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-spam-to-inbox:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.btn-not-spam {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-not-spam:hover {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}

/* ==========================================================================
   CALENDAR & MEETING INVITATION STYLES
   ========================================================================== */

/* 1. Meeting Card inside Email Reader */
.calendar-invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 18px 22px;
  margin: 16px 24px 0 24px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.08);
  animation: banner-slide-down 0.25s ease-out;
}

.cal-card-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
  min-width: 280px;
}

.cal-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 58px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.cal-badge-month {
  width: 100%;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cal-badge-day {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.cal-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.cal-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-event-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cal-rsvp-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.cal-rsvp-badge.badge-accepted {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.cal-rsvp-badge.badge-tentative {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.cal-rsvp-badge.badge-declined {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.cal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.cal-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

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

.cal-meta-item svg {
  color: var(--primary);
  flex-shrink: 0;
}

.cal-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.btn-meet-join {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff !important;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: var(--transition);
  text-decoration: none;
}

.btn-meet-join:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.5);
  color: #ffffff !important;
}

.rsvp-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.rsvp-btn-group {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.btn-rsvp {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border-right: 1px solid var(--border-color);
}

.btn-rsvp:last-child {
  border-right: none;
}

.btn-rsvp:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-rsvp#btn-rsvp-yes.active {
  background: #10b981;
  color: #ffffff;
}

.btn-rsvp#btn-rsvp-maybe.active {
  background: #3b82f6;
  color: #ffffff;
}

.btn-rsvp#btn-rsvp-no.active {
  background: #ef4444;
  color: #ffffff;
}

/* 2. Compose Modal Meeting Scheduler Section */
.compose-calendar-section {
  margin: 2px 0 6px 0;
}

.compose-cal-toggle-row {
  display: flex;
  align-items: center;
}

.btn-cal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 4px 11px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-cal-toggle.active {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  border-color: var(--primary);
}

.compose-meeting-box {
  margin-top: 10px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action input {
  flex: 1;
}

/* 3. Calendar View Layout */
.calendar-sidebar {
  width: 280px;
}

.calendar-sidebar-events {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}

.sidebar-event-card {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-event-card:hover {
  transform: translateX(3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.sidebar-event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-event-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}

.sidebar-event-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-event-sub {
  font-size: 11.5px;
  color: var(--text-dim);
}

.btn-event-quick-join {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: #3b82f6 !important;
  background: rgba(59, 130, 246, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  text-decoration: none;
}

.btn-event-quick-join:hover {
  background: #3b82f6;
  color: #ffffff !important;
}

.empty-sidebar-events {
  padding: 20px 10px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

.calendar-main-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  overflow: hidden;
  background: var(--bg-main);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.cal-nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cal-nav-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-month-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.calendar-view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
  overflow-y: auto;
}

.calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(110px, auto);
  gap: 1px;
  background: var(--border-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 10px;
}

.calendar-day-cell {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--bg-card);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
  cursor: pointer;
  transition: var(--transition);
}

.calendar-day-cell:hover {
  background: var(--bg-hover);
}

.calendar-day-cell.other-month {
  background: var(--bg-main);
  opacity: 0.45;
}

.calendar-day-cell.today {
  background: rgba(59, 130, 246, 0.06);
}

.calendar-day-cell.today .day-number {
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  align-self: flex-start;
}

.cell-events-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 90px;
  min-width: 0;
}

.calendar-event-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  background: rgba(59, 130, 246, 0.15);
  border-left: 3px solid #3b82f6;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: var(--transition);
}

.calendar-event-pill:hover {
  background: rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}

.calendar-event-pill.declined {
  opacity: 0.45;
  text-decoration: line-through;
  border-left-color: #ef4444;
}

.pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3b82f6;
  flex-shrink: 0;
}

.pill-time {
  font-weight: 600;
  color: var(--primary);
  font-size: 10px;
  flex-shrink: 0;
}

.pill-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ==========================================================================
   PERSONAL NOTES STYLES
   ========================================================================== */

.notes-sidebar {
  width: 260px;
}

.notes-tags-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 12px;
}

.tag-badge-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.tag-badge-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.tag-badge-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  font-weight: 600;
}

.tag-badge-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.badge-sub {
  font-size: 11px;
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
  margin-left: 8px;
}

.no-tags-hint {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 8px;
}

.notes-main-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  overflow: hidden;
  background: var(--bg-main);
}

.notes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  gap: 16px;
}

.notes-search-wrapper {
  position: relative;
  flex: 1;
  max-width: 460px;
}

.notes-search-wrapper input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 13.5px;
  transition: var(--transition);
}

.notes-search-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

.notes-body-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quick-note-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  color: var(--text-dim);
}

.quick-note-box:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
  color: var(--primary);
}

.quick-note-placeholder {
  font-size: 14px;
  color: var(--text-dim);
}

.notes-group-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notes-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

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

.note-card {
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 140px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.note-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

/* Note Color Variants */
.note-card.note-yellow {
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.04) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.note-card.note-blue {
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.04) 100%);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.note-card.note-green {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.04) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.note-card.note-purple {
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.12) 0%, rgba(139, 92, 246, 0.04) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.note-card.note-rose {
  background: linear-gradient(145deg, rgba(244, 63, 94, 0.12) 0%, rgba(244, 63, 94, 0.04) 100%);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.note-card.note-dark {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.note-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.note-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin: 0;
  word-break: break-word;
}

.btn-pin-note {
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  opacity: 0.6;
}

.note-card:hover .btn-pin-note,
.btn-pin-note.pinned {
  opacity: 1;
}

.btn-pin-note.pinned {
  color: var(--primary);
}

.btn-pin-note:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.note-card-content {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
  word-break: break-word;
  max-height: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* The note content is rendered markdown (HTML), not raw text, so we must NOT
   use white-space: pre-wrap here — the newlines the renderer inserts between
   block tags would otherwise show up as large blank gaps. Also trim the outer
   margins of the first/last block so the card stays tight. */
.note-card-content.md-content > :first-child { margin-top: 0; }
.note-card-content.md-content > :last-child { margin-bottom: 0; }
.note-card-content.md-content .md-h { margin-top: 6px; }
.note-card-content.md-content .md-ul,
.note-card-content.md-content .md-ol { margin: 2px 0 6px; }
.note-card-content.md-content .md-pre,
.note-card-content.md-content .md-table-wrap,
.note-card-content.md-content .md-quote { margin: 4px 0 6px; }
.note-card-content.md-content .md-hr { margin: 6px 0; }

.note-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.note-tag-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

.note-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 11px;
  color: var(--text-dim);
}

.btn-icon-xs {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 3px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-xs:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Modal Inputs for Notes */
.note-title-input {
  font-size: 18px !important;
  font-weight: 700 !important;
  border: none !important;
  border-bottom: 1px solid var(--border-color) !important;
  border-radius: 0 !important;
  padding: 8px 0 !important;
  background: transparent !important;
}

.note-title-input:focus {
  border-bottom-color: var(--primary) !important;
  box-shadow: none !important;
}

.note-content-input {
  font-size: 14px !important;
  line-height: 1.6 !important;
  border: none !important;
  background: transparent !important;
  padding: 8px 0 !important;
  resize: vertical;
}

.note-content-input:focus {
  outline: none !important;
}

.note-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.note-color-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.color-swatches {
  display: flex;
  gap: 8px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--primary);
  transform: scale(1.15);
}

.swatch-yellow { background: #f59e0b; }
.swatch-blue   { background: #3b82f6; }
.swatch-green  { background: #10b981; }
.swatch-purple { background: #8b5cf6; }
.swatch-rose   { background: #f43f5e; }
.swatch-dark   { background: #334155; }

/* Antivirus Alert Banner */
.virus-alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin: 16px 24px 0 24px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18) 0%, rgba(185, 28, 28, 0.12) 100%);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.15);
  animation: banner-slide-down 0.25s ease-out;
}

.virus-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.virus-banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  flex-shrink: 0;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.virus-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.virus-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: #f87171;
  letter-spacing: -0.2px;
}

.virus-banner-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Document & Image Preview Modal */
.modal-preview-card {
  width: 95vw !important;
  max-width: 1100px !important;
  height: 88vh !important;
  max-height: 88vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--border-color);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-panel);
  flex-shrink: 0;
  gap: 16px;
}

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

.preview-file-icon {
  font-size: 26px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.preview-title-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.preview-filename {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.preview-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.preview-divider {
  opacity: 0.5;
}

.preview-security-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.preview-security-badge.badge-clean {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.preview-security-badge.badge-virus {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.preview-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.preview-zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.preview-zoom-text {
  font-size: 11.5px;
  font-weight: 600;
  min-width: 44px;
  text-align: center;
  color: var(--text-muted);
}

.preview-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preview-body {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  padding: 0 !important;
}

/* Image Viewer */
.preview-img-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 24px;
}

.preview-img-element {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease-out;
}

/* PDF Viewer */
.preview-pdf-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
}

.preview-pdf-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* Text / Code Viewer */
.preview-text-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: auto;
  padding: 20px;
  background: var(--bg-canvas);
}

.preview-text-element {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* Office & Archive Info Card */
.preview-office-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.preview-office-card {
  max-width: 540px;
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.office-card-icon {
  font-size: 54px;
  margin-bottom: 16px;
}

.office-card-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  word-break: break-all;
}

.office-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.office-meta-table {
  width: 100%;
  background: var(--bg-input);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.meta-label {
  color: var(--text-dim);
  font-weight: 500;
}

.meta-value {
  color: var(--text-main);
  font-weight: 600;
}

.office-actions {
  width: 100%;
}

.office-actions .btn {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
}

/* Virus Warning Inside Modal */
.preview-virus-alert {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}

.virus-alert-card {
  max-width: 460px;
  width: 100%;
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid #ef4444;
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(239, 68, 68, 0.25);
}

.virus-alert-icon {
  font-size: 52px;
  margin-bottom: 12px;
}

.virus-alert-card h3 {
  font-size: 18px;
  color: #f87171;
  font-weight: 700;
  margin-bottom: 10px;
}

.virus-alert-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.virus-alert-buttons {
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   Professional Overview & Health Dashboard Styles
   ========================================================================== */
.overview-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px 0;
}

.overview-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.overview-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.overview-grid-roles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.overview-grid-objects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .overview-grid-4, .overview-grid-roles {
    grid-template-columns: repeat(2, 1fr);
  }
  .overview-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .overview-grid-4, .overview-grid-3, .overview-grid-roles, .overview-grid-objects {
    grid-template-columns: 1fr;
  }
}

.metric-card-pro {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.metric-card-pro:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.metric-card-pro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--card-accent, #3b82f6);
  opacity: 0.8;
}

.metric-header-pro {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-title-pro {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

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

.metric-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-value-pro {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.metric-progress-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.metric-progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.metric-footer-pro {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.role-card-pro {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.role-card-pro:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.role-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-info-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.role-info-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.role-info-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.1;
}

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

.spec-list-pro {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spec-item-pro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.spec-item-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.spec-item-icon-box {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.spec-item-value {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono, monospace);
}

.storage-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.storage-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e293b;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #60a5fa;
  flex-shrink: 0;
  overflow: hidden;
}

.storage-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Username suggestions chips */
.username-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: monospace;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.username-chip:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #3b82f6;
  color: #ffffff;
  transform: translateY(-1px);
}
.username-chip:active {
  transform: translateY(0);
}

/* ==========================================================================
   NEW MAIL FEATURES: Star, Bulk Selection, Custom Folders, Archive, Drafts
   ========================================================================== */

/* Star Button */
.btn-star {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  transition: transform 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
}
.btn-star:hover {
  transform: scale(1.2);
  color: #f59e0b;
}
.btn-star.starred {
  color: #f59e0b;
}

/* Checkbox & Star in mail item */
.mail-select-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.mail-checkbox {
  cursor: pointer;
  width: 15px;
  height: 15px;
  accent-color: #3b82f6;
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}
.mail-item:hover .mail-checkbox,
.mail-checkbox:checked {
  opacity: 1;
}

/* Mail Item Hover Actions */
.mail-hover-actions {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  gap: 4px;
  background: var(--bg-panel);
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  z-index: 5;
}
.mail-item:hover .mail-hover-actions {
  display: flex;
}
.btn-hover-action {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn-hover-action:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Bulk Toolbar */
.mail-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0,0,0,0.12);
  min-height: 40px;
}
.btn-bulk-action {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-bulk-action:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: rgba(255,255,255,0.25);
}

/* Custom Folders in Sidebar */
.custom-folder-item {
  position: relative;
}
.folder-action-btn {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: auto;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.nav-item:hover .folder-action-btn {
  opacity: 1;
}
.folder-action-btn:hover {
  color: var(--text-main);
  background: rgba(255,255,255,0.12);
}

/* Banners for Archive & Draft */
.archive-alert-banner {
  background: rgba(139, 92, 246, 0.1);
  border-bottom: 1px solid rgba(139, 92, 246, 0.25);
  padding: 12px 20px;
}
.draft-alert-banner {
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  padding: 12px 20px;
}
.folder-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13.5px;
  font-weight: 500;
}
.folder-select-item:hover {
  background: var(--bg-hover);
  border-color: #3b82f6;
  color: #60a5fa;
}

/* ==========================================================================
   File Manager & Attachment Sharing System
   ========================================================================== */
#section-files {
  display: none;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

#section-files.active {
  display: flex !important;
}

.files-sidebar {
  width: 260px;
  min-width: 260px;
}

.files-category-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.cat-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.cat-chip:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.cat-chip.active {
  background: var(--bg-active);
  color: var(--primary);
  font-weight: 600;
}

.files-storage-meter {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.storage-meter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.storage-meter-header strong {
  color: var(--text-main);
}

.storage-meter-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.storage-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.storage-meter-footer {
  font-size: 11px;
  color: var(--text-dim);
}

/* Files Main Pane */
.files-main-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  overflow: hidden;
}

.files-toolbar {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-panel);
}

.files-search-wrapper {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.files-search-wrapper input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.files-search-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

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

.files-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-group-sm {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-group-sm .btn {
  border: none;
  border-radius: 0;
  padding: 6px 10px;
}

.btn-group-sm .btn.active {
  background: var(--primary);
  color: #fff;
}

/* Dropzone & Container */
.files-dropzone-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  position: relative;
  transition: background 0.2s ease;
}

.files-dropzone-container.dragover {
  background: rgba(59, 130, 246, 0.08);
  border: 2px dashed #3b82f6;
}

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

.files-list-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* File Card (Grid Mode) */
.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
}

.file-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(59, 130, 246, 0.4);
}

.file-card-preview {
  height: 120px;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.file-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.file-card:hover .file-card-preview img {
  transform: scale(1.05);
}

.file-card-preview-icon {
  font-size: 42px;
  user-select: none;
}

.file-card-source-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  color: #93c5fd;
  font-weight: 500;
}

.file-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.file-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.file-card-meta {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.file-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.file-badge {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.file-badge-private {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.file-badge-shared {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.file-badge-public {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.file-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: auto;
}

.file-card-actions .btn-icon-sm {
  width: 28px;
  height: 28px;
}

/* File Row (List Mode) */
.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.file-row:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: var(--bg-hover);
}

.file-row-icon {
  font-size: 22px;
  width: 32px;
  text-align: center;
}

.file-row-name {
  flex: 2;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-row-owner {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-row-size {
  width: 80px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

.file-row-date {
  width: 110px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: right;
}

.file-row-badges {
  width: 120px;
  display: flex;
  justify-content: center;
}

.file-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Sharing Modal Components */
.file-share-info-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.file-share-info-card .file-icon-box {
  font-size: 28px;
}

.share-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.share-user-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.share-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  font-size: 11.5px;
  color: #60a5fa;
  cursor: pointer;
  transition: all 0.15s ease;
}

.share-user-chip:hover {
  background: rgba(59, 130, 246, 0.25);
}

/* File Picker Grid in Compose */
.file-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.file-picker-card {
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s ease;
}

.file-picker-card:hover {
  border-color: #3b82f6;
  background: var(--bg-hover);
}

.file-picker-card.selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 0 0 2px #3b82f6;
}

.file-picker-card-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.file-picker-card-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* Save to Files button on incoming mail attachments */
.btn-save-attachment-to-files {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-save-attachment-to-files:hover {
  border-color: #3b82f6;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
}


/* ==========================================================================
   TO-DO LIST / TASKS
   ========================================================================== */

/* Shared progress bar (also reused by task cards & summary) */
.progress-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Sidebar overall progress summary */
.task-progress-summary {
  padding: 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-progress-ring-wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.task-progress-percent {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
}

.task-progress-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Toolbar action cluster (view/priority selects + report buttons).
   Kept on one tidy row on desktop; wraps cleanly on smaller screens. */
.notes-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

/* Professional select control with a custom chevron so it looks consistent
   across browsers and matches the input/button height in the toolbar. */
.task-filter-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  height: 36px;
  width: auto;
  background-color: var(--bg-input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 32px 0 12px;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 34px;
  cursor: pointer;
  transition: var(--transition);
}

.task-filter-select:hover {
  border-color: var(--border-focus);
  background-color: var(--bg-hover);
}

.task-filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Tasks list */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

/* Tasks & Generic Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  margin-top: 18px;
  border-radius: var(--radius-md);
  gap: 12px;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.pagination-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pagination-ellipsis {
  padding: 0 4px;
  color: var(--text-dim);
  font-size: 13px;
}
.pagination-size-select {
  display: flex;
  align-items: center;
}
.pagination-size-select select {
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.task-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--text-dim);
  transition: var(--transition);
}

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

.task-card.status-todo { border-left-color: var(--text-dim); }
.task-card.status-progress { border-left-color: var(--warning); }
.task-card.status-done { border-left-color: var(--success); }

.task-card.is-done .task-card-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-card-check {
  padding-top: 2px;
}

.task-card-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--success);
}

.task-card-body {
  flex: 1;
  cursor: pointer;
  min-width: 0;
}

.task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.task-card-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-word;
}

.task-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 4px 0 10px;
  word-break: break-word;
}

/* The description is rendered markdown (HTML), not raw text, so we must NOT
   use white-space: pre-wrap here — the newlines the renderer inserts between
   block tags would otherwise show up as large blank gaps. Also trim the outer
   margins of the first/last block so the card stays tight. */
.task-card-desc.md-content > :first-child { margin-top: 0; }
.task-card-desc.md-content > :last-child { margin-bottom: 0; }
.task-card-desc.md-content .md-h { margin-top: 6px; }
.task-card-desc.md-content .md-ul,
.task-card-desc.md-content .md-ol { margin: 2px 0 6px; }
.task-card-desc.md-content .md-pre,
.task-card-desc.md-content .md-table-wrap,
.task-card-desc.md-content .md-quote { margin: 4px 0 6px; }
.task-card-desc.md-content .md-hr { margin: 6px 0; }

.task-progress-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}

.task-progress-value {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 34px;
  text-align: right;
}

.task-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.task-status-badge,
.task-priority-badge,
.task-tag,
.task-due {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.task-status-badge {
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  background: var(--bg-input);
}

.task-priority-badge {
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
}
.task-priority-badge.prio-high { color: var(--danger); border-color: rgba(239, 68, 68, 0.4); }
.task-priority-badge.prio-medium { color: var(--warning); border-color: rgba(245, 158, 11, 0.4); }
.task-priority-badge.prio-low { color: var(--success); border-color: rgba(16, 185, 129, 0.4); }

.task-tag {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.25);
  cursor: pointer;
  transition: var(--transition);
}
.task-tag:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.45);
}

.task-due {
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}
.task-due.overdue {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.task-card-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Task modal form */
.task-form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.task-progress-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Give the task modal's dropdowns a consistent custom chevron so they look
   polished and match across browsers (native arrows are hidden). */
#modal-task select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}
#modal-task select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .task-form-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   TO-DO: ASSIGNMENT & WORKER PROGRESS DASHBOARD (Option B)
   ========================================================================== */

.task-assign-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.task-assign-badge.assigned-to-me {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--info);
}

.task-assignee-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--warning);
}

/* Worker progress dashboard */
.tasks-workers-panel {
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.tasks-workers-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.tasks-workers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.worker-progress-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.worker-progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.worker-progress-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.worker-progress-pct {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.worker-progress-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   FLOATING FILE PICKER (matches Gmail-style compose window)
   ========================================================================== */
.file-picker-window {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 560px;
  max-width: calc(100vw - 32px);
  z-index: 95; /* above compose window (90), no full-screen backdrop */
  display: flex;
  animation: compose-pop-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.file-picker-window.hidden {
  display: none !important;
}

.file-picker-panel {
  width: 100%;
  max-height: calc(100vh - 60px);
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.theme-light .file-picker-panel {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.file-picker-header {
  background: #1e293b;
  cursor: default;
}

body.theme-light .file-picker-header {
  background: #f1f5f9;
}

@keyframes compose-pop-in {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
  .file-picker-window {
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
  }
  .file-picker-panel {
    border-radius: 0 !important;
  }
}

/* ==========================================================================
   MARKDOWN RENDERED CONTENT (Notes & Task descriptions)
   ========================================================================== */
.md-content { line-height: 1.6; word-break: break-word; }
.md-content p { margin: 0 0 8px; }
.md-content p:last-child { margin-bottom: 0; }

.md-content .md-h { margin: 10px 0 6px; font-weight: 700; line-height: 1.3; }
.md-content .md-h1 { font-size: 1.25em; }
.md-content .md-h2 { font-size: 1.15em; }
.md-content .md-h3 { font-size: 1.05em; }
.md-content .md-h4,
.md-content .md-h5,
.md-content .md-h6 { font-size: 1em; color: var(--text-muted); }

.md-content .md-ul { margin: 4px 0 8px; padding-left: 24px; list-style-type: disc; }
.md-content .md-ol { margin: 4px 0 8px; padding-left: 24px; list-style-type: decimal; }
.md-content .md-ul li,
.md-content .md-ol li { margin: 3px 0; }

/* Nested lists */
.md-content .md-ul .md-ul,
.md-content .md-ol .md-ul { list-style-type: circle; margin: 2px 0 4px; padding-left: 22px; }
.md-content .md-ul .md-ul .md-ul,
.md-content .md-ol .md-ul .md-ul { list-style-type: square; margin: 2px 0 4px; padding-left: 22px; }
.md-content .md-ol .md-ol,
.md-content .md-ul .md-ol { list-style-type: lower-alpha; margin: 2px 0 4px; padding-left: 22px; }
.md-content .md-ol .md-ol .md-ol,
.md-content .md-ul .md-ol .md-ol { list-style-type: lower-roman; margin: 2px 0 4px; padding-left: 22px; }

.md-content .md-task-item { list-style-type: none !important; margin-left: -16px !important; display: flex; align-items: baseline; gap: 8px; }
.md-content .md-task-checkbox { margin: 0; cursor: default; }

.md-content strong { font-weight: 700; }
.md-content em { font-style: italic; }
.md-content del { opacity: 0.7; }

.md-content a {
  color: var(--primary);
  text-decoration: underline;
  word-break: break-all;
}

.md-content .md-code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 5px;
}

.md-content .md-pre {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 6px 0 10px;
  overflow-x: auto;
}
.md-content .md-pre code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  white-space: pre;
  background: none;
  border: none;
  padding: 0;
}

.md-content .md-quote {
  border-left: 3px solid var(--primary);
  padding: 4px 12px;
  margin: 6px 0 10px;
  color: var(--text-muted);
  background: rgba(59, 130, 246, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.md-content .md-hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 10px 0;
}

.md-content .md-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 8px 0 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.md-content .md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
  text-align: left;
}

.md-content .md-table th,
.md-content .md-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  vertical-align: top;
}

.md-content .md-table th:last-child,
.md-content .md-table td:last-child {
  border-right: none;
}

.md-content .md-table tbody tr:last-child td {
  border-bottom: none;
}

.md-content .md-table th {
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-input);
  letter-spacing: 0.02em;
}

.md-content .md-table tbody tr:hover {
  background: var(--bg-hover);
}

.md-content .md-table td {
  color: var(--text-main);
}

/* ==========================================================================
   MARKDOWN EDITOR WRITE / PREVIEW TABS (Note & Task modals)
   ========================================================================== */
.md-editor-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.md-tab {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.md-tab:hover { background: var(--bg-hover); color: var(--text-main); }
.md-tab.active {
  background: var(--bg-active);
  color: var(--primary);
  border-color: var(--border-focus);
}

.md-editor-hint {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.md-preview {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  padding: 12px 14px;
  min-height: 120px;
  max-height: 420px;
  overflow-y: auto;
}

.md-preview-empty {
  color: var(--text-dim);
  font-style: italic;
}

/* ==========================================================================
   MARKDOWN FORMATTING TOOLBAR (Note & Task modals)
   ========================================================================== */
.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.md-tool {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}
.md-tool:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-color);
}
.md-tool:active {
  background: var(--bg-active);
  color: var(--primary);
}

.md-tool-sep {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  margin: 0 4px;
}

/* ==========================================================================
   MOBILE / PWA — GMAIL-STYLE NATIVE ADAPTATION
   Elements only appear on small screens; desktop layout is untouched.
   ========================================================================== */

/* Hidden by default (desktop). Shown inside the mobile media query. */
.mobile-bottom-nav,
.mobile-fab,
.mobile-scrim,
.mobile-back-btn {
  display: none;
}

@media (max-width: 768px) {
  /* --- App shell fills the viewport, room reserved for bottom nav --- */
  html, body {
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;          /* guard: never allow horizontal overflow (prevents zoom-out) */
  }
  .view-screen, #app, #main-view {
    max-width: 100%;
    overflow-x: hidden;
  }

  .navbar {
    padding: 8px 10px;
    gap: 8px;
  }
  /* Compact brand + hide verbose bits on the top bar */
  .navbar .brand-name { display: none; }
  .navbar .view-switchers { display: none; }        /* replaced by bottom nav */
  .navbar .user-info-text { display: none; }         /* avatar only */
  .navbar .user-profile-menu .btn-icon { display: none; }
  .navbar .nav-center { flex: 1; min-width: 0; }
  /* iOS auto-zooms when focusing inputs with font-size < 16px. Force 16px on
     ALL text inputs/selects/textareas (incl. login) to prevent the zoom-out. */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .layout-body {
    /* leave space for the 56px bottom nav */
    padding-bottom: 56px;
    min-height: 0;
  }

  /* Fill available space via flex instead of height:100% so the padded
     bottom-nav gap is respected and inner panes can scroll. */
  .app-section.active {
    height: auto;
    flex: 1 1 auto;
  }

  /* --- Notes / Tasks toolbar: stack search on top, actions below --- */
  .notes-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }
  .notes-search-wrapper {
    max-width: 100%;
    width: 100%;
  }
  /* Action cluster wraps into a neat grid so selects/buttons never overflow */
  .notes-toolbar-actions {
    width: 100%;
    gap: 8px;
  }
  /* View + priority selects share the first row, each taking half the width */
  .notes-toolbar-actions .task-filter-select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    height: 40px;
    line-height: 38px;
  }
  /* Report / refresh buttons: compact, equal-width, on their own row(s) */
  .notes-toolbar-actions .btn-sm {
    flex: 1 1 auto;
    justify-content: center;
    height: 40px;
  }

  /* --- Sidebar becomes a slide-in drawer --- */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px !important;
    min-width: 280px !important;
    max-width: 85vw;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    border-radius: 0;
  }
  /* On mobile the collapsed (icon-rail) desktop mode should not apply */
  .sidebar.collapsed {
    width: 280px !important;
    min-width: 280px !important;
  }
  .sidebar.collapsed .nav-text-group,
  .sidebar.collapsed .menu-label,
  .sidebar.collapsed .sidebar-bottom,
  .sidebar.collapsed .btn-compose span,
  .sidebar.collapsed .task-progress-summary,
  .sidebar.collapsed .notes-tags-list {
    display: revert !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }
  .mobile-scrim.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* --- List / detail stack: list full width, detail slides over --- */
  .app-section {
    flex-direction: column;
    min-height: 0;            /* allow children to shrink so scroll works */
  }

  .mail-list-pane,
  .notes-main-pane,
  .files-main-pane,
  .calendar-main-pane {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto;
    min-height: 0;            /* critical: enables inner overflow scrolling */
    border-right: none;
  }

  /* The scrollable message list needs a constrained, scrollable box */
  .mail-list-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mail-detail-pane {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 120;               /* above list, below drawer */
    background: var(--bg-main);
    transform: translateX(100%);
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
  }
  /* Slide the detail in when a message is open (JS toggles this class) */
  .mail-detail-pane.mobile-detail-open {
    transform: translateX(0);
  }

  /* Show the back arrow in the detail toolbar */
  .mobile-back-btn {
    display: inline-flex !important;
    margin-right: 4px;
  }

  /* --- Detail toolbar: single clean row, Gmail-style icon actions --- */
  .detail-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    height: 52px;
    padding: 0 6px;
    gap: 2px;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  /* The action group scrolls horizontally instead of wrapping into rows */
  .detail-toolbar .toolbar-left {
    flex: 1;
    min-width: 0;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .detail-toolbar .toolbar-left::-webkit-scrollbar { display: none; }

  /* Compact icon-only action buttons (hide the text labels) */
  .detail-toolbar .toolbar-left .btn {
    flex: 0 0 auto;
    padding: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    justify-content: center;
  }
  .detail-toolbar .toolbar-left .btn span { display: none; }
  .detail-toolbar .toolbar-left .btn svg {
    width: 18px;
    height: 18px;
    margin: 0;
  }

  .detail-toolbar .toolbar-right {
    flex: 0 0 auto;
    gap: 0;
    padding-left: 4px;
    margin-left: 2px;
    border-left: 1px solid var(--border-color);
  }
  .detail-toolbar .toolbar-right .btn-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  /* Hide desktop-only power-user buttons on mobile to keep the bar clean */
  .detail-toolbar #btn-toggle-canvas,
  .detail-toolbar .mobile-hide {
    display: none !important;
  }

  .detail-toolbar .mobile-back-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  /* --- Attachments: single-column cards, compact icon-only actions --- */
  .attach-pills {
    grid-template-columns: 1fr;   /* one card per row so nothing overflows */
    gap: 8px;
  }

  .attachment-item-card {
    padding: 8px 10px;
    gap: 8px;
  }

  /* Icon-only action buttons keep the card from overflowing the screen */
  .attachment-item-card .att-card-actions {
    gap: 2px;
  }
  .attachment-item-card .btn-att-action {
    padding: 0;
    width: 36px;
    height: 36px;
    justify-content: center;
    flex: 0 0 auto;
  }
  .attachment-item-card .btn-att-action span {
    display: none;              /* hide "Preview" / "Save to Files" / "Download" text */
  }
  .attachment-item-card .btn-att-action svg {
    margin: 0;
  }

  /* Give the reading canvas room; it should not be squeezed by attachments */
  .mail-body-container {
    padding: 12px 14px;
  }
  .mail-paper-canvas {
    padding: 16px 16px;
  }

  /* --- Bottom navigation bar --- */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    z-index: 130;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease;
  }
  .mobile-nav-item svg { opacity: 0.8; }
  .mobile-nav-item.active {
    color: var(--primary);
  }
  .mobile-nav-item.active svg { opacity: 1; }

  /* --- Floating Action Button (compose) --- */
  .mobile-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 18px;
    bottom: 72px;               /* above the bottom nav */
    width: 56px;
    height: 56px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.45);
    cursor: pointer;
    z-index: 135;
  }
  .mobile-fab:active { transform: scale(0.95); }

  /* Compose full-screen behavior on phones is already handled by the earlier
     .compose-window mobile rule; nothing extra needed here. */

  /* Floating file picker goes full-screen too (consistency with compose) */
  .file-picker-window { bottom: 0; top: 0; }
  .file-picker-panel { max-height: 100vh; border-radius: 0; }

  /* Modals must sit above the bottom nav (130) and FAB (135) so their
     footers (e.g. Sign Out) aren't covered on mobile. */
  .modal-overlay {
    z-index: 300 !important;
  }

  /* Modals use more of the screen */
  .modal-card {
    max-width: 96vw !important;
    max-height: 92vh !important;
  }
  .modal-card.modal-lg { max-width: 96vw !important; }
  .modal-body { max-height: 70vh; overflow-y: auto; }

  /* --- Profile modal: stack avatar over details, scrollable tabs --- */
  .profile-tabs-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
  }
  .profile-tabs-nav::-webkit-scrollbar { display: none; }
  .profile-tabs-nav .tab-btn {
    flex: 0 0 auto;
    font-size: 12px !important;
    padding: 10px 10px !important;
  }
  /* The avatar+details row and any form-row stack vertically */
  #ptab-info > div:first-child {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }
  #ptab-info > div:first-child > div:first-child {
    width: 100% !important;       /* avatar box full width, centered */
  }
  .form-row {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .form-row .form-group { width: 100% !important; }

  /* Profile modal footer: keep buttons compact and on one row */
  #modal-profile .modal-footer {
    flex-wrap: nowrap;
    gap: 8px;
  }
  #modal-profile .modal-footer .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  #modal-profile .modal-footer > div {
    flex: 0 0 auto;
  }

  /* Larger tap targets */
  .mail-list-item { padding: 12px 14px; }
  .btn-icon { min-width: 40px; min-height: 40px; }
}

/* Small phones */
@media (max-width: 380px) {
  .mobile-nav-item span { font-size: 9px; }
}

/* ==========================================================================
   SECURITY & AUDIT (login trail, active sessions, revoke)
   ========================================================================== */
.sec-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border-color);
}
.sec-ev-ok   { background: rgba(16, 185, 129, 0.12); color: var(--success); border-color: rgba(16, 185, 129, 0.35); }
.sec-ev-fail { background: rgba(239, 68, 68, 0.12);  color: var(--danger);  border-color: rgba(239, 68, 68, 0.35); }
.sec-ev-warn { background: rgba(245, 158, 11, 0.12); color: var(--warning); border-color: rgba(245, 158, 11, 0.35); }
.sec-ev-mute { background: var(--bg-input); color: var(--text-muted); }

.sec-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }
.sec-detail { color: var(--text-muted); font-size: 12px; }
.sec-empty { text-align: center; color: var(--text-muted); padding: 24px; }

.sec-tag-you {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  vertical-align: middle;
}

/* User self-service active-session rows (profile Security tab) */
.sessions-list { display: flex; flex-direction: column; gap: 8px; }
.sessions-empty { font-size: 13px; color: var(--text-muted); padding: 10px 0; }
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
}
.session-device { font-size: 13px; font-weight: 600; color: var(--text-main); }
.session-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; word-break: break-word; }
.session-action { flex-shrink: 0; }

/* ==========================================================================
   IMPERSONATION BANNER
   ========================================================================== */
.impersonation-banner {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  padding: 8px 20px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  z-index: 100;
  position: relative;
  animation: slideDownBanner 0.25s ease-out;
}

@keyframes slideDownBanner {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.impersonation-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
  margin: 0 auto;
  gap: 16px;
  flex-wrap: wrap;
}

.impersonation-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.impersonation-badge-icon {
  font-size: 17px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-impersonate-exit {
  background: #0f172a !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  padding: 5px 14px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.btn-impersonate-exit:hover {
  background: #1e293b !important;
  border-color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   File Manager: Floating Upload Progress Dock & Dropzone Overlay
   ========================================================================== */
.files-dropzone-container {
  position: relative;
}

.files-drop-overlay {
  position: absolute;
  inset: 12px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px dashed #3b82f6;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 0 40px rgba(59, 130, 246, 0.2);
}

body.theme-light .files-drop-overlay {
  background: rgba(241, 245, 249, 0.92);
  border-color: #2563eb;
  box-shadow: inset 0 0 30px rgba(37, 99, 235, 0.15);
}

.files-dropzone-container.dragover .files-drop-overlay {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.files-drop-icon-anim {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.18);
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulseDrop 1.5s infinite ease-in-out;
}

@keyframes pulseDrop {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.08); }
}

.files-drop-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.files-drop-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* Floating Upload Progress Dock */
.upload-dock-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: slideUpDock 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.theme-light .upload-dock-container {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

@keyframes slideUpDock {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.upload-dock-container.minimized {
  width: auto;
  min-width: 260px;
  border-radius: 30px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.upload-dock-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
}

body.theme-light .upload-dock-header {
  background: rgba(0, 0, 0, 0.02);
}

.upload-dock-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.upload-dock-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.upload-dock-icon.done {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.upload-dock-icon.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.upload-dock-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.upload-dock-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-dock-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
}

.upload-dock-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.upload-dock-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-dock-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Overall Progress Bar */
.upload-dock-overall-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

body.theme-light .upload-dock-overall-bar {
  background: rgba(0, 0, 0, 0.08);
}

.upload-dock-overall-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  width: 0%;
  transition: width 0.2s ease-out;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.upload-dock-overall-fill.all-done {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.upload-dock-overall-fill.has-error {
  background: #ef4444;
}

/* Items List */
.upload-dock-body {
  max-height: 250px;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-dock-container.minimized .upload-dock-body,
.upload-dock-container.minimized .upload-dock-overall-bar,
.upload-dock-container.minimized .upload-dock-footer {
  display: none !important;
}

.upload-dock-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  transition: background 0.15s ease;
}

body.theme-light .upload-dock-item {
  background: rgba(248, 250, 252, 0.8);
  border-color: #e2e8f0;
}

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

.upload-item-file-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}

.upload-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.upload-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.upload-item-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-item-pct {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
}

.upload-item-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.upload-item-status-row.status-error {
  color: #ef4444;
}

.upload-item-status-row.status-completed {
  color: #10b981;
}

.upload-item-status-row.status-cancelled {
  color: var(--text-dim);
}

.upload-item-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 3px;
}

body.theme-light .upload-item-bar {
  background: rgba(0, 0, 0, 0.08);
}

.upload-item-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.15s ease-out;
}

.upload-item-bar-fill.done {
  background: #10b981;
}

.upload-item-bar-fill.error {
  background: #ef4444;
}

.upload-item-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 12px;
  transition: var(--transition);
}

.upload-item-action-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.upload-dock-footer {
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

body.theme-light .upload-dock-footer {
  background: rgba(0, 0, 0, 0.02);
}

.upload-dock-footer-stats {
  color: var(--text-muted);
  font-size: 11.5px;
}

.upload-dock-footer-actions {
  display: flex;
  gap: 8px;
}

.upload-dock-footer-actions button {
  background: transparent;
  border: none;
  font-size: 11.5px;
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.upload-dock-footer-actions button:hover {
  background: var(--bg-hover);
}

/* ==========================================================================
   Admin Console: About & System Information Dashboard Styles
   ========================================================================== */
.about-hero-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-xl);
  padding: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  margin-bottom: 24px;
}

body.theme-light .about-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border-color: #cbd5e1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.about-hero-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.about-hero-content {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

.about-logo-badge {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.about-hero-info {
  flex: 1;
  min-width: 280px;
}

.about-hero-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.about-hero-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.about-version-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  font-size: 12px;
  font-weight: 600;
}

body.theme-light .about-version-pill {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
  border-color: rgba(99, 102, 241, 0.25);
}

.about-version-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.about-hero-tagline {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.about-hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.about-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-size: 11.5px;
  color: var(--text-main);
  font-weight: 500;
}

body.theme-light .about-chip {
  background: #e2e8f0;
}

/* About Grid Layout */
.about-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.about-spec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.about-spec-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.about-spec-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.about-spec-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.about-spec-title-group h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2px;
}

.about-spec-title-group p {
  font-size: 12px;
  color: var(--text-muted);
}

.about-spec-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.about-spec-label {
  color: var(--text-muted);
  font-weight: 500;
}

.about-spec-val {
  color: var(--text-main);
  font-weight: 600;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 12px;
  text-align: right;
}

/* Changelog / Release History Timeline */
.about-timeline {
  position: relative;
  padding-left: 24px;
  margin-top: 14px;
  border-left: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.about-timeline-item {
  position: relative;
}

.about-timeline-dot {
  position: absolute;
  left: -31px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-main);
  border: 2px solid var(--primary);
}

.about-timeline-item.active .about-timeline-dot {
  background: var(--primary);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

.about-timeline-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.about-timeline-version {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.about-timeline-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.about-timeline-tag.current {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.about-timeline-tag.released {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.about-timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-timeline-list li {
  font-size: 12.5px;
  color: var(--text-muted);
  position: relative;
  padding-left: 14px;
}

.about-timeline-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* ==========================================================================
   Admin Console: License & Subscription Dashboard Styles
   ========================================================================== */
.license-hero-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-xl);
  padding: 26px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  margin-bottom: 24px;
}

body.theme-light .license-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
  border-color: #fde68a;
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.08);
}

.license-hero-card.status-active {
  border-color: rgba(16, 185, 129, 0.4);
}

.license-hero-card.status-expired {
  border-color: rgba(239, 68, 68, 0.4);
}

.license-hero-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.license-hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

.license-hero-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  min-width: 280px;
}

.license-badge-icon {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.license-badge-icon.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
}

.license-badge-icon.expired {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35);
}

.license-hero-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.license-hero-heading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.license-tier-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.license-status-tag {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.license-status-tag.active {
  background: rgba(16, 185, 129, 0.18);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.license-status-tag.community {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.license-status-tag.expired {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.license-org-name {
  font-size: 13.5px;
  color: var(--text-muted);
}

.license-id-chip {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-dim);
}

/* Quota Progress Cards */
.license-meter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.license-meter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.license-meter-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(245, 158, 11, 0.3);
}

.license-meter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.license-meter-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.license-meter-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.license-meter-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

body.theme-light .license-meter-track {
  background: rgba(0, 0, 0, 0.08);
}

.license-meter-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  transition: width 0.3s ease;
}

.license-meter-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.license-meter-fill.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.license-meter-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Feature Matrix Grid */
.license-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.license-feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  font-size: 12.5px;
}

body.theme-light .license-feature-item {
  background: rgba(248, 250, 252, 0.8);
}

.license-feature-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.license-feature-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-main);
}

.license-feature-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.license-feature-check.disabled {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

/* Activation Box */
.license-key-textarea {
  width: 100%;
  height: 110px;
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 12px;
  color: #38bdf8;
  resize: vertical;
  line-height: 1.4;
  margin-bottom: 12px;
}

body.theme-light .license-key-textarea {
  background: #f8fafc;
  color: #0f172a;
}

.license-key-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}




.md-mermaid { margin: 6px 0; padding: 8px; overflow-x: auto; text-align: center; white-space: pre-wrap; background: var(--bg-secondary, transparent); border-radius: 8px; }
.md-mermaid[data-mermaid="done"] { white-space: normal; }
.md-mermaid svg { max-width: 100%; height: auto; }
.md-mermaid-msg { color: #d93025; font-size: 12px; margin-bottom: 4px; }

/* ==========================================================================
   BRANDING & APPEARANCE CUSTOMIZATION COMPONENTS
   ========================================================================== */

.theme-accent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-accent-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.theme-accent-card.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 16px var(--primary-glow);
}

.accent-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.user-accent-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-main);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-accent-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.user-accent-btn.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 0 12px var(--primary-glow);
}

.user-accent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}



/* ==========================================================================
   DOCS (Markdown documentation library)
   ========================================================================== */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.doc-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
}

.doc-card:hover,
.doc-card:focus-visible {
  border-color: var(--primary);
  transform: translateY(-1px);
  outline: none;
}

.doc-card-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }

.doc-card-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.doc-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  word-break: break-word;
}

.doc-card-excerpt {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.doc-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  font-size: 12px;
}

.doc-owner { color: var(--text-dim); font-size: 11.5px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.doc-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.doc-badge-shared { color: #10b981; background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.3); }
.doc-badge-edit   { color: #f59e0b; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); }
.doc-badge-view   { color: #3b82f6; background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.3); }

.doc-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.modal-card.modal-doc { max-width: 920px; }
.modal-doc .modal-body { max-height: 70vh; overflow-y: auto; }

.doc-reader { font-size: 14.5px; line-height: 1.7; padding-top: 6px; }

.doc-content-input {
  min-height: 320px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  resize: vertical;
}

@media (max-width: 768px) {
  .doc-card { flex-direction: column; gap: 8px; }
  .doc-card-side { flex-direction: row; align-items: center; gap: 10px; }
  .modal-card.modal-doc { max-width: 96vw; }
}

/* Docs: embedded images */
.md-content img.md-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin: 6px 0;
  display: block;
}

.doc-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px;
}

.doc-image-thumb {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}

.doc-image-thumb:hover,
.doc-image-thumb:focus-visible {
  border-color: var(--primary);
  outline: none;
}

.doc-image-thumb img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.doc-image-thumb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-image-hint { grid-column: 1 / -1; font-size: 12px; color: var(--text-dim); padding: 8px 0; }

/* ==========================================================================
   FLOATING EDITORS (Notes / Tasks / Docs) + DRAFT DOCK
   ========================================================================== */
.float-win {
  position: fixed;
  z-index: 91;
  display: flex;
  flex-direction: column;
  min-width: 360px;
  min-height: 300px;
  max-width: 100vw;
  max-height: calc(100vh - 8px);
  resize: both;
  overflow: hidden;
  background: #111827;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 10px rgba(0, 0, 0, 0.4);
}

body.theme-light .float-win {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.float-win.hidden,
.float-win.fw-min { display: none !important; }

.float-win.fw-max {
  left: 2vw !important;
  top: 2vh !important;
  width: 96vw !important;
  height: 96vh !important;
  resize: none;
  border-radius: 14px;
}

.fw-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  height: 44px;
  padding: 0 8px 0 12px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: move;
  user-select: none;
  touch-action: none;
}

body.theme-light .fw-header {
  background: #f1f5f9;
  border-bottom-color: #e2e8f0;
}

.float-win.fw-max .fw-header { cursor: default; }

.fw-grip { color: var(--text-dim); font-size: 14px; line-height: 1; }

.fw-header h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.fw-status {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.fw-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.fw-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.fw-btn:hover,
.fw-btn:focus-visible { background: rgba(255, 255, 255, 0.12); color: var(--text-main); outline: none; }
body.theme-light .fw-btn:hover,
body.theme-light .fw-btn:focus-visible { background: rgba(0, 0, 0, 0.08); }
.fw-btn-close:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.fw-draftbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 14px;
  font-size: 12px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  flex-shrink: 0;
}

.fw-link {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.float-win > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.float-win .modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-height: none !important;
  padding: 14px 18px;
}

.float-win .modal-footer { flex-shrink: 0; padding: 10px 16px; }

/* The main editor area grows with the window. */
.float-win .modal-body > .form-group:has(> textarea) {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 230px;
}

.float-win .modal-body > .form-group:has(> textarea) > textarea,
.float-win .modal-body > .form-group:has(> textarea) > .md-preview {
  flex: 1;
  min-height: 130px;
  resize: none;
  overflow: auto;
}

/* Dock for minimized editors and saved drafts */
#float-dock {
  position: fixed;
  left: 16px;
  bottom: 0;
  z-index: 95;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.fw-chip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  height: 36px;
  padding: 0 6px 0 12px;
  background: #1e293b;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.3);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

body.theme-light .fw-chip { background: #f1f5f9; border-color: #cbd5e1; }

.fw-chip:hover,
.fw-chip:focus-visible { border-color: var(--primary); outline: none; }

.fw-chip-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }

.fw-chip-tag {
  flex-shrink: 0;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

.fw-chip-x {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.fw-chip-x:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

@media (max-width: 768px) {
  .float-win,
  .float-win.fw-max {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none;
    min-width: 0;
    border-radius: 0;
    resize: none;
    z-index: 200 !important;
  }
  .fw-btn-max { display: none; }
  .fw-status { display: none; }
  #float-dock {
    left: 8px;
    right: 80px;
    max-width: none;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
}

/* System Health History graphs */
.health-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}
.health-history-grid > .metric-card-pro {
  min-width: 0;
  gap: 8px;
  transform: none !important;
}
.health-history-grid > .metric-card-pro[data-wide] {
  grid-column: 1 / -1;
}
.health-history-grid canvas {
  display: block;
  width: 100%;
  height: 170px;
}
.health-history-grid .metric-title-pro {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  line-height: 1.4;
}
.health-history-grid .hh-stat {
  font-weight: 500;
  opacity: 0.85;
  white-space: nowrap;
}
.health-history-grid .hh-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}
@media (max-width: 900px) {
  .health-history-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Light mode: stronger contrast for the health history cards */
body.theme-light .health-history-grid > .metric-card-pro {
  background: var(--card-solid) !important;
  border-color: var(--hair-strong) !important;
  border-top: 3px solid var(--card-accent, var(--brand)) !important;
}
body.theme-light .health-history-grid .metric-title-pro {
  color: var(--ink) !important;
  font-weight: 700 !important;
}
body.theme-light .health-history-grid .hh-stat {
  color: var(--muted);
  font-weight: 600;
  opacity: 1;
}
body.theme-light .health-history-grid .hh-dot {
  box-shadow: 0 0 0 1px rgba(34, 26, 20, 0.25);
}
body.theme-light #health-history-section .overview-section-title {
  color: var(--ink) !important;
}
body.theme-light #health-history-section select.form-control {
  background: var(--card-solid);
  color: var(--ink);
  border: 1px solid var(--hair-strong);
}

/* ==========================================================================
   TANDEM WARM EDITORIAL BENTO DESIGN SYSTEM OVERRIDES
   (Webmail, Admin Dashboard, Calendar, Notes, Docs, Tasks, Files)
   ========================================================================== */

/* 1. Top Workspace Bar (.navbar) — Tandem Header & Toolbar */
.navbar {
  height: 58px;
  padding: 8px 14px 4px;
  background: var(--page) !important;
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.nav-left {
  gap: 12px;
}

.brand {
  gap: 9px;
}

.brand-logo-nav {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  filter: none;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-hub-tag {
  border-left: 1px solid var(--hair-strong);
  color: var(--muted);
  white-space: nowrap;
  padding-left: 12px;
  margin-left: 3px;
  font-size: 13.5px;
  font-weight: 500;
}

/* Theme Sun/Moon Icon Toggle */
body.theme-light #btn-theme-toggle .i-moon,
body:not(.theme-light) #btn-theme-toggle .i-sun {
  display: none;
}
body.theme-light #btn-theme-toggle .i-sun,
body:not(.theme-light) #btn-theme-toggle .i-moon {
  display: block;
}

/* Circular Tandem Icon Buttons */
.navbar .btn-icon,
.pane-header .btn-icon,
.detail-toolbar .btn-icon,
.cal-nav-buttons .btn-icon,
.modal-header .btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--hair-strong);
  background: color-mix(in srgb, var(--card-solid) 70%, transparent);
  color: var(--ink);
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.navbar .btn-icon:hover,
.pane-header .btn-icon:hover,
.detail-toolbar .btn-icon:hover,
.cal-nav-buttons .btn-icon:hover,
.modal-header .btn-icon:hover {
  background: var(--card-solid);
  border-color: var(--faint);
  color: var(--ink);
}

#btn-toggle-sidebar.active {
  background: var(--act) !important;
  color: var(--on-act) !important;
  border-color: var(--act) !important;
}

/* Pill Search Bar in Top Navbar */
.nav-center {
  max-width: 440px;
}

.search-input-wrapper input {
  height: 38px;
  border-radius: 99px !important;
  background: var(--qcard) !important;
  border: 1px solid var(--hair-strong) !important;
  color: var(--ink) !important;
  font-size: 13.5px;
  padding-left: 38px;
  box-shadow: none !important;
}

.search-input-wrapper input::placeholder {
  color: var(--faint) !important;
}

.search-input-wrapper input:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent) !important;
}

/* Pill-Segmented Workspace Switcher (.view-switchers) */
.view-switchers {
  background: var(--column) !important;
  border: 1px solid var(--hair) !important;
  border-radius: 99px !important;
  padding: 4px !important;
  gap: 3px;
}

.view-switchers .btn-tab {
  border-radius: 99px !important;
  height: 32px;
  padding: 0 14px !important;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  box-shadow: none !important;
  transform: none !important;
}

.view-switchers .btn-tab:hover {
  color: var(--ink);
  background: var(--bg-hover);
}

.view-switchers .btn-tab.active {
  background: var(--act) !important;
  color: var(--on-act) !important;
  font-weight: 650;
}

/* User Profile Pill in Navbar */
.user-profile-menu {
  border-left: 1px solid var(--hair-strong);
  padding-left: 12px;
  gap: 8px;
}

.user-avatar,
.sender-avatar {
  background: var(--hl) !important;
  color: var(--hl-ink) !important;
  border: 1px solid color-mix(in srgb, var(--hl-ink) 18%, transparent);
  font-weight: 700;
}

/* 2. Bento 3-Column Island Workspace Architecture */
#main-view {
  background: var(--page);
}

.layout-body {
  padding: 4px 12px 12px 12px;
  background: var(--page);
  gap: 12px;
}

.app-section.active {
  gap: 12px;
}

/* 3. Tandem Sidebar (.sidebar) & Capsule Navigation */
.sidebar {
  width: 236px;
  min-width: 236px;
  background: var(--side) !important;
  border: none !important;
  border-right: none !important;
  box-shadow: none !important;
  padding: 8px 6px 8px;
  gap: 2px;
  overflow: visible !important;
  position: relative;
  z-index: 30;
}

.sidebar-top {
  margin-bottom: 14px;
  padding: 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 60;
  overflow: visible !important;
}

.sidebar-top .btn-compose {
  margin-top: 0 !important;
  overflow: hidden;
}

/* Primary Compose / Create Pill Button */
.btn,
.btn-sm {
  border-radius: 99px !important;
  font-weight: 650;
}

.btn-primary {
  background: linear-gradient(100deg, var(--brand-2), var(--brand)) !important;
  color: #fdfbf8 !important;
  border: 1px solid transparent !important;
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--brand) 60%, transparent) !important;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--card) !important;
  border: 1px solid var(--hair-strong) !important;
  color: var(--ink) !important;
}

.btn-outline:hover {
  background: var(--card-solid) !important;
  border-color: var(--faint) !important;
}

.btn-compose {
  display: flex !important;
  width: 100%;
  border-radius: 99px !important;
  height: 42px;
  padding: 0 18px !important;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* Sidebar Section Group Labels (.side__group) */
.menu-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--faint) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 0 12px 6px !important;
  margin-top: 8px;
}

.sidebar-menu > .menu-label:first-child {
  margin-top: 0;
}

/* Capsule Navigation Items (.nav) */
.nav-list {
  gap: 2px !important;
}

.nav-item {
  border-radius: 99px !important;
  padding: 6px 12px 6px 8px !important;
  min-height: 40px;
  gap: 11px !important;
  color: var(--muted) !important;
  font-weight: 500;
  font-size: 13.5px;
  box-shadow: none !important;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-hover) !important;
  color: var(--ink) !important;
}

/* Circular Icon Box inside Sidebar (.nav svg) */
.nav-item .nav-icon-box {
  width: 30px !important;
  height: 30px !important;
  border-radius: 50% !important;
  border: 1px solid var(--hair-strong) !important;
  background: transparent !important;
  color: var(--muted) !important;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.nav-item:hover .nav-icon-box {
  color: var(--ink) !important;
  border-color: var(--faint) !important;
}

.nav-item .nav-title {
  color: inherit !important;
  font-weight: inherit !important;
  font-size: 13.5px;
}

.nav-item .nav-subtitle {
  color: var(--faint) !important;
  font-size: 11px;
}

/* Active Capsule Item (.nav[aria-current=page]) */
.nav-item.active {
  background: var(--hl) !important;
  color: var(--hl-ink) !important;
  font-weight: 650 !important;
  box-shadow: none !important;
}

.nav-item.active .nav-title {
  color: var(--hl-ink) !important;
  font-weight: 650 !important;
}

.nav-item.active .nav-subtitle {
  color: color-mix(in srgb, var(--hl-ink) 76%, var(--ink)) !important;
}

.nav-item.active .nav-icon-box {
  background: var(--card-solid) !important;
  border-color: transparent !important;
  color: var(--brand) !important;
}

/* Sidebar Counts & Alert Badges (.nav__count) */
.folder-total-count,
.nav-item .badge {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  border-radius: 99px;
}

.nav-item.active .folder-total-count,
.nav-item.active .badge:not(.badge-unread) {
  color: var(--hl-ink) !important;
  background: transparent;
}

.badge-unread {
  background: var(--bad-bg) !important;
  color: var(--bad) !important;
  box-shadow: none !important;
  min-width: 22px;
  height: 22px;
  padding: 0 7px !important;
  border-radius: 99px !important;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

/* Sidebar Goal / Storage Quota Card (.side__goal) */
.sidebar-bottom {
  border-top: none !important;
  padding: 14px 4px 2px !important;
}

.quota-container,
.files-storage-meter,
.task-progress-summary {
  border-radius: var(--r-md) !important;
  background: var(--column) !important;
  border: 1px solid var(--hair) !important;
  padding: 14px !important;
  box-shadow: none !important;
}

.quota-label,
.storage-meter-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
}

.quota-label span:last-child,
.storage-meter-header strong {
  color: var(--ink) !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quota-bar-wrapper,
.storage-meter-bar,
.progress-bar-track {
  height: 8px !important;
  background: var(--tick-off) !important;
  border-radius: 99px !important;
  border: none !important;
  margin: 6px 0 4px;
}

.quota-bar-fill,
.storage-meter-fill,
.progress-bar-fill {
  background: linear-gradient(90deg, var(--brand-2), var(--brand)) !important;
  border-radius: 99px !important;
}

/* Collapsed Icon-Only Rail (.sidebar.collapsed) & Uncollapse Curtain Layout */
.sidebar:not(.collapsed) .sidebar-menu {
  overflow-x: hidden !important;
  overflow-y: auto;
  width: 100%;
}

.sidebar:not(.collapsed) .sidebar-menu > .nav-list,
.sidebar:not(.collapsed) .sidebar-menu > .notes-tags-list {
  min-width: 214px;
}

.sidebar:not(.collapsed) .nav-item .nav-text-group {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar.collapsed {
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  padding: 10px 6px !important;
  overflow: visible !important;
  align-items: center;
}

.sidebar.collapsed .sidebar-top {
  width: 100%;
  padding: 0 !important;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 60;
  overflow: visible !important;
}

.sidebar.collapsed .sidebar-top .dropdown-wrap {
  width: auto !important;
  display: flex;
  justify-content: center;
  position: relative;
  overflow: visible !important;
}

.sidebar.collapsed .docs-dropdown-menu {
  left: 0;
  top: calc(100% + 8px);
  width: 256px;
  z-index: 1200;
}

.sidebar.collapsed .btn-compose {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
}

.sidebar.collapsed .btn-compose span,
.sidebar.collapsed .btn-compose svg:not(:first-of-type),
.sidebar.collapsed .btn-compose .docs-compose-caret {
  display: none !important;
}

.sidebar.collapsed .nav-item {
  width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  margin: 0 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
}

.sidebar.collapsed .nav-item .nav-icon-box {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  margin: 0 !important;
  border-color: transparent !important;
  background: transparent !important;
}

/* 4. Middle Queue Island (.mail-list-pane & .docs-list-column) */
.mail-list-pane {
  width: 356px;
  background: var(--column) !important;
  border: 1px solid var(--hair) !important;
  border-radius: var(--r-xl) !important;
  overflow: hidden;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.pane-header {
  height: auto;
  padding: 18px 16px 8px 20px;
  border-bottom: none;
}

.pane-header .header-left h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.pane-header #folder-count-badge {
  background: var(--sunk);
  border: 1px solid var(--hair);
  color: var(--muted);
  border-radius: 99px;
  padding: 3px 10px;
  font-variant-numeric: tabular-nums;
}

.mail-list-toolbar {
  background: transparent !important;
  border-bottom: 1px solid var(--hair) !important;
  padding: 6px 18px 10px !important;
}

/* Mail Category Filter Chips (.fchip) */
.mail-category-tabs {
  padding: 8px 12px 4px;
  gap: 5px;
  border-bottom: none !important;
}

.mail-cat-tab {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  border-radius: 99px;
  border: 1px solid var(--hair-strong);
  background: var(--card);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.mail-cat-tab:hover {
  color: var(--ink);
  background: var(--card-solid);
}

.mail-cat-tab.active {
  background: var(--act) !important;
  color: var(--on-act) !important;
  border-color: var(--act) !important;
}

.mail-cat-tab .cat-unread {
  background: color-mix(in srgb, var(--on-act) 20%, transparent);
  color: inherit;
  border-radius: 99px;
}

/* Queue Card Items (.qi__main) */
.mail-list-container {
  padding: 8px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mail-item {
  border-radius: var(--r-lg) !important;
  background: var(--qcard) !important;
  border: 1px solid var(--hair) !important;
  padding: 12px 14px !important;
  gap: 10px;
  align-items: flex-start;
  transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease;
}

.mail-item .mail-select-controls {
  padding-top: 7px;
  gap: 6px;
}

.mail-item .sender-avatar {
  width: 32px;
  height: 32px;
  font-size: 12.5px;
  margin-top: 1px;
}

.mail-item-top {
  gap: 8px;
  align-items: center;
}

.mail-sender {
  flex: 1;
  min-width: 0;
  max-width: none;
}

.mail-item:hover {
  border-color: var(--hair-strong) !important;
  background: var(--qcard) !important;
}

.mail-item.unread {
  background: var(--qcard) !important;
  border-color: var(--hair-strong) !important;
}

.mail-item.unread .mail-sender {
  font-weight: 700;
  color: var(--ink);
}

.mail-item.unread .mail-sender::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  margin-right: 6px;
  vertical-align: middle;
}

/* Selected Queue Card (.qi.is-on .qi__main) */
.mail-item.selected {
  background: var(--hl) !important;
  border-color: transparent !important;
  border-left: 1px solid transparent !important;
}

.mail-item.selected .sender-avatar {
  background: color-mix(in srgb, var(--card-solid) 82%, transparent) !important;
  color: var(--ink) !important;
  border-color: transparent !important;
}

.mail-item.selected .mail-sender,
.mail-item.selected .mail-subject-row {
  color: var(--hl-ink) !important;
  font-weight: 650;
}

.mail-item.selected .mail-snippet,
.mail-item.selected .mail-date {
  color: color-mix(in srgb, var(--hl-ink) 78%, var(--ink)) !important;
}

.mail-date {
  background: var(--sunk);
  border: 1px solid var(--hair);
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.35;
}

.mail-item.selected .mail-date {
  background: color-mix(in srgb, var(--card-solid) 70%, transparent);
  border-color: transparent;
}

/* 5. Right Main Record / Detail Islands (.record) */
.mail-detail-pane,
.admin-content-pane,
.calendar-main-pane,
.notes-main-pane,
.files-main-pane {
  border-radius: var(--r-xl) !important;
  background: var(--wash) !important;
  border: 1px solid var(--hair) !important;
  height: 100% !important;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.detail-toolbar,
.calendar-toolbar,
.notes-toolbar,
.files-toolbar {
  background: transparent !important;
  border-bottom: 1px solid var(--hair) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
}

.mail-header-card {
  margin: 14px 18px 0;
  border-radius: var(--r-lg);
  background: var(--card) !important;
  border: 1px solid var(--hair) !important;
  box-shadow: var(--shadow-card);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.mail-subject {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.mail-body-container {
  background: transparent !important;
  padding: 14px 18px 20px;
}

.mail-paper-canvas {
  background: var(--card-solid) !important;
  border: 1px solid var(--hair) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-card) !important;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.mail-paper-canvas.canvas-light {
  background: #fdfbf8 !important;
  color: #221a14 !important;
  border-color: #d1c9be !important;
}

.mail-paper-canvas.canvas-light .text-body-view {
  color: #221a14 !important;
}

.mail-paper-canvas.canvas-light .text-body-view blockquote,
.mail-paper-canvas.canvas-light .quote-line {
  color: #54493f !important;
  background: #f3efe9 !important;
  border-left-color: #b84a23 !important;
}

.mail-paper-canvas.canvas-dark {
  background: #241e19 !important;
  color: #f3ece5 !important;
  border-color: #453a31 !important;
}

.mail-paper-canvas.canvas-dark .text-body-view {
  color: #f3ece5 !important;
}

.mail-paper-canvas.canvas-dark .text-body-view blockquote,
.mail-paper-canvas.canvas-dark .quote-line {
  color: #c4b7aa !important;
  background: rgba(255, 138, 92, 0.08) !important;
  border-left-color: #ff8a5c !important;
}

.compose-send-btn,
body.theme-light .compose-send-btn {
  background: linear-gradient(100deg, var(--brand-2), var(--brand)) !important;
  color: #fdfbf8 !important;
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--brand) 60%, transparent) !important;
}

body.theme-light .compose-from-select,
body.theme-light .compose-save-draft-btn {
  background: var(--card-solid) !important;
  color: var(--ink) !important;
  border-color: var(--hair-strong) !important;
}

/* 6. Tandem Admin Dashboard Overview & Pipeline Bar */
.admin-content-pane {
  padding: 22px 24px 32px;
}

.tandem-crumbs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hair);
}

.tandem-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--faint);
}

.tandem-crumbs svg {
  width: 14px;
  height: 14px;
}

.tandem-crumbs b {
  color: var(--ink);
  font-weight: 650;
}

.tandem-state-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--good);
  background: var(--good-bg);
  padding: 4px 12px;
  border-radius: 99px;
}

.page-title-bar h2 {
  font-size: clamp(22px, 2.2vw, 28px);
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--ink);
}

/* Tandem 4-Stage Pipeline Bar (.tandem-proc) */
.tandem-proc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.tandem-proc__lead {
  background: linear-gradient(100deg, var(--brand-2), var(--brand));
  color: #fdfbf8;
  border-radius: 99px;
  padding: 9px 22px 9px 18px;
  line-height: 1.3;
  display: grid;
}

.tandem-proc__lead b {
  font-size: 13.5px;
  font-weight: 650;
}

.tandem-proc__lead small {
  opacity: 0.88;
  font-size: 11.5px;
}

.tandem-proc__track {
  background: var(--sunk);
  border: 1px solid var(--hair);
  isolation: isolate;
  border-radius: 99px;
  height: 48px;
  padding: 4px;
  display: flex;
  position: relative;
  overflow: hidden;
}

.tandem-proc__fill {
  z-index: -1;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
  border-radius: 99px;
  position: absolute;
  inset: 0;
}

.tandem-proc__st {
  min-width: 0;
  color: #fdfbf8;
  flex: 1;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
}

.tandem-proc__ic {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #fdfbf8;
  background: rgba(255, 255, 255, 0.2);
}

.tandem-proc__ic svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4px;
}

.tandem-proc__st.is-now .tandem-proc__ic {
  color: var(--brand-2);
  background: #fdfbf8;
  font-weight: 700;
}

.tandem-proc__name {
  white-space: nowrap;
  text-overflow: ellipsis;
  align-items: baseline;
  gap: 6px;
  display: flex;
  overflow: hidden;
}

.tandem-proc__name small {
  opacity: 0.85;
  font-size: 11.5px;
  font-weight: 500;
}

.tandem-proc__won {
  background: var(--good-bg);
  height: 40px;
  color: var(--good);
  border-radius: 99px;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
}

@media (max-width: 960px) {
  .tandem-proc {
    grid-template-columns: 1fr;
  }
  .tandem-proc__lead,
  .tandem-proc__won {
    justify-self: start;
  }
}

/* Admin Bento Cards (.metric-card-pro, .role-card-pro, .card, .table-card) */
.metric-card-pro,
.role-card-pro,
.card,
.table-card {
  background: var(--card) !important;
  border: 1px solid var(--hair) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-card) !important;
}

.metric-card-pro::before {
  display: none !important;
}

.metric-card-pro:hover,
.role-card-pro:hover {
  border-color: var(--hair-strong) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md) !important;
}

.metric-title-pro,
.role-info-title,
.overview-section-title {
  color: var(--faint) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

.metric-value-pro,
.role-info-count {
  color: var(--ink) !important;
  font-weight: 600 !important;
  letter-spacing: -0.03em !important;
  font-variant-numeric: tabular-nums;
}

.metric-icon-badge,
.role-icon-box,
.spec-item-icon-box {
  border-radius: 50% !important;
  background: var(--sunk) !important;
  border: 1px solid var(--hair-strong) !important;
  color: var(--brand) !important;
}

.metric-progress-wrap {
  height: 8px !important;
  background: var(--tick-off) !important;
  border-radius: 99px !important;
}

.metric-progress-bar {
  background: linear-gradient(90deg, var(--brand-2), var(--brand)) !important;
  border-radius: 99px !important;
}

.spec-item-pro {
  background: var(--sunk) !important;
  border: 1px solid var(--hair) !important;
  border-radius: var(--r-sm) !important;
}

/* Admin Search & Filter Toolbars (.admin-filter-toolbar) */
.admin-filter-toolbar {
  background: var(--card) !important;
  border: 1px solid var(--hair) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-card) !important;
}

.admin-filter-toolbar .search-box input,
.admin-filter-toolbar .filter-select,
.admin-filter-toolbar .results-counter,
.notes-search-wrapper input,
.files-search-wrapper input,
.task-filter-select {
  border-radius: 99px !important;
  background: var(--card-solid) !important;
  border: 1px solid var(--hair-strong) !important;
  color: var(--ink) !important;
}

/* Tables (.data-table) */
.data-table th {
  background: var(--sunk) !important;
  color: var(--muted) !important;
  border-bottom: 1px solid var(--hair) !important;
  font-weight: 650;
}

.data-table td {
  border-bottom: 1px solid var(--hair) !important;
  color: var(--ink);
}

.data-table tr:hover td {
  background: var(--bg-hover) !important;
}

/* Status Badges (.badge-success, .badge-warning, .badge-danger, .badge-info) */
.badge-success {
  background: var(--good-bg) !important;
  color: var(--good) !important;
  border-radius: 99px !important;
}

.badge-warning {
  background: var(--warm-bg) !important;
  color: var(--warm) !important;
  border-radius: 99px !important;
}

.badge-danger {
  background: var(--bad-bg) !important;
  color: var(--bad) !important;
  border-radius: 99px !important;
}

.badge-info {
  background: var(--cold-bg) !important;
  color: var(--cold) !important;
  border-radius: 99px !important;
}

/* 7. Calendar, Notes, Tasks, Files & Docs Islands */
.calendar-month-grid {
  border-radius: var(--r-lg) !important;
  border: 1px solid var(--hair) !important;
  background: var(--hair) !important;
}

.calendar-day-cell {
  background: var(--card-solid) !important;
}

.calendar-day-cell.other-month {
  background: var(--sunk) !important;
  opacity: 0.6;
}

.calendar-day-cell.today {
  background: color-mix(in srgb, var(--hl) 45%, var(--card-solid)) !important;
}

.calendar-event-pill {
  background: var(--hl) !important;
  color: var(--hl-ink) !important;
  border-left: 3px solid var(--brand) !important;
  border-radius: 6px !important;
}

.quick-note-box {
  border-radius: 99px !important;
  background: var(--card-solid) !important;
  border: 1px solid var(--hair-strong) !important;
  box-shadow: var(--shadow-card) !important;
}

.note-card,
.task-card,
.doc-card,
.file-card,
.file-list-row {
  border-radius: var(--r-lg) !important;
  background: var(--card-solid) !important;
  border: 1px solid var(--hair) !important;
  box-shadow: var(--shadow-card) !important;
}

.note-card.note-yellow {
  background: var(--warm-bg) !important;
  border-color: color-mix(in srgb, var(--warm) 30%, var(--hair)) !important;
}
.note-card.note-blue {
  background: var(--cold-bg) !important;
  border-color: color-mix(in srgb, var(--cold) 30%, var(--hair)) !important;
}
.note-card.note-green {
  background: var(--good-bg) !important;
  border-color: color-mix(in srgb, var(--good) 30%, var(--hair)) !important;
}
.note-card.note-rose {
  background: var(--bad-bg) !important;
  border-color: color-mix(in srgb, var(--bad) 30%, var(--hair)) !important;
}
.note-card.note-purple {
  background: var(--hl) !important;
  border-color: color-mix(in srgb, var(--brand) 30%, var(--hair)) !important;
}

.cat-chip,
.tag-badge-item {
  border-radius: 99px !important;
}

.cat-chip.active,
.tag-badge-item.active {
  background: var(--hl) !important;
  color: var(--hl-ink) !important;
}

/* 8. Modals, Dialogs, Inputs & Floating Toasts (.dlg & .toast) */
.modal-overlay {
  background: var(--scrim) !important;
  backdrop-filter: blur(4px);
}

.modal-card:not(.luxury-modal-card) {
  background: var(--card-solid) !important;
  border: 1px solid var(--hair-strong) !important;
  border-radius: var(--r-xl) !important;
  box-shadow: var(--shadow-pop) !important;
  color: var(--ink) !important;
}

.modal-header {
  border-bottom: 1px solid var(--hair) !important;
  padding: 20px 24px 14px !important;
}

.modal-header h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.modal-footer {
  background: var(--sunk) !important;
  border-top: 1px solid var(--hair) !important;
  padding: 14px 24px !important;
}

.form-group input:not(.luxury-input),
.form-group select,
.form-group textarea,
.form-input,
.form-control {
  background: var(--page) !important;
  border: 1px solid var(--hair-strong) !important;
  border-radius: var(--r-sm) !important;
  color: var(--ink) !important;
}

.form-input,
.form-control {
  padding: 8px 12px !important;
  font-size: 13px !important;
}

.note-title-input {
  padding: 10px 14px !important;
}

.note-content-input {
  padding: 12px 14px !important;
}

.form-group input:not(.luxury-input):focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent) !important;
  outline: none;
}

/* Tandem Calendar Daily Task Recap Modal */
.tandem-recap-modal {
  max-width: 520px !important;
  width: 92% !important;
  max-height: 84vh !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
}

.tandem-recap-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--wash) !important;
  padding: 20px 24px 16px !important;
}

.tandem-recap-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-text, var(--brand));
  margin-bottom: 3px;
}

.tandem-recap-body {
  padding: 16px 24px 20px !important;
  overflow-y: auto;
  flex: 1;
}

.tandem-recap-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tandem-recap-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--hair);
}

.tandem-recap-stat-pill.stat-done {
  background: var(--good-bg);
  color: var(--good);
  border-color: color-mix(in srgb, var(--good) 28%, var(--hair));
}

.tandem-recap-stat-pill.stat-progress {
  background: var(--warm-bg);
  color: var(--warm);
  border-color: color-mix(in srgb, var(--warm) 28%, var(--hair));
}

.tandem-recap-stat-pill.stat-todo {
  background: var(--sunk);
  color: var(--muted);
}

.tandem-recap-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tandem-recap-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--sunk);
  border: 1px solid var(--hair);
  border-left: 3px solid var(--brand);
  color: var(--ink);
  cursor: pointer;
  transition: var(--transition);
}

.tandem-recap-item:hover {
  background: var(--card-solid);
  border-color: var(--hair-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.tandem-recap-item.is-done {
  border-left-color: var(--good);
}

.tandem-recap-item.is-progress {
  border-left-color: var(--warm);
}

.tandem-recap-item.is-overdue {
  border-left-color: var(--bad);
}

.tandem-recap-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card-solid);
  border: 1px solid var(--hair);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tandem-recap-item-body {
  flex: 1;
  min-width: 0;
}

.tandem-recap-item-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 5px;
  word-break: break-word;
}

.tandem-recap-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

.tandem-recap-meta-chip {
  background: var(--card-solid);
  border: 1px solid var(--hair);
  padding: 1px 8px;
  border-radius: 99px;
  color: var(--muted);
  font-weight: 500;
}

.tandem-recap-prio {
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 650;
  text-transform: capitalize;
}

.tandem-recap-prio.prio-high {
  background: var(--bad-bg);
  color: var(--bad);
}

.tandem-recap-prio.prio-medium {
  background: var(--warm-bg);
  color: var(--warm);
}

.tandem-recap-prio.prio-low {
  background: var(--good-bg);
  color: var(--good);
}

.tandem-recap-status-text {
  color: var(--faint);
  font-weight: 500;
}

.tandem-recap-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  background: var(--sunk);
  border-radius: var(--r-md);
  border: 1px dashed var(--hair-strong);
}

.tandem-recap-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tandem Floating Pill Toast */
.toast-container {
  left: 0;
  right: 0;
  bottom: 24px;
  align-items: center;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  border-radius: 99px !important;
  background: var(--act) !important;
  color: var(--on-act) !important;
  border: none !important;
  padding: 12px 20px !important;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 16px 40px -14px rgba(26, 18, 12, 0.45) !important;
}

/* Floating Editors & Compose Window Harmonization */
.float-win,
.compose-window,
.file-picker-panel {
  background: var(--card-solid) !important;
  border: 1px solid var(--hair-strong) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-pop) !important;
}

.fw-header,
.compose-header,
.file-picker-header {
  background: var(--sunk) !important;
  color: var(--ink) !important;
  border-bottom: 1px solid var(--hair) !important;
}

/* ============================================================================
   TANDEM 4-COLUMN KANBAN BOARD & DRAG-AND-DROP (To-Do · Progress · In Review · Completed)
   ============================================================================ */
.tasks-layout-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--sunk);
  border: 1px solid var(--hair-strong);
  border-radius: 99px;
}

.tasks-layout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: none;
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tasks-layout-btn:hover {
  color: var(--ink);
}

.tasks-layout-btn.active {
  background: var(--act);
  color: var(--on-act);
  box-shadow: 0 2px 8px rgba(26, 18, 12, 0.18);
}

.tasks-list.is-kanban-mode {
  display: block;
  padding: 4px 0 12px;
}

.tasks-kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(255px, 1fr));
  gap: 14px;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: calc(100vh - 230px);
}

.task-kanban-col {
  display: flex;
  flex-direction: column;
  background: var(--sunk);
  border: 1px solid var(--hair);
  border-radius: var(--r-lg, 18px);
  padding: 12px;
  min-height: 420px;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
}

.task-kanban-col.drag-over {
  border-color: var(--brand);
  background: var(--brand-bg);
  box-shadow: 0 0 0 2px var(--brand-ring), var(--shadow-soft);
}

.task-kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 4px 2px;
}

.task-kanban-col-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.task-kanban-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.task-kanban-dot.dot-todo {
  background: var(--faint);
  box-shadow: 0 0 0 3px rgba(154, 138, 120, 0.18);
}

.task-kanban-dot.dot-progress {
  background: var(--warm);
  box-shadow: 0 0 0 3px var(--warm-bg);
}

.task-kanban-dot.dot-review {
  background: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.16);
}

.task-kanban-dot.dot-done {
  background: var(--good);
  box-shadow: 0 0 0 3px var(--good-bg);
}

.task-kanban-col-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.task-kanban-col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--card-solid);
  border: 1px solid var(--hair);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.task-kanban-add-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--hair);
  background: var(--card-solid);
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.task-kanban-add-btn:hover {
  background: var(--act);
  color: var(--on-act);
  border-color: var(--act);
}

.task-kanban-col-sub {
  font-size: 11.5px;
  color: var(--faint);
  padding: 0 4px 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}

.task-kanban-col-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 260px;
}

.task-kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  padding: 28px 14px;
  margin-top: 4px;
  border: 1px dashed var(--hair-strong);
  border-radius: var(--r-md, 13px);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.25);
  pointer-events: none;
}

[data-theme="dark"] .task-kanban-empty {
  background: rgba(0, 0, 0, 0.14);
}

.task-kanban-empty span {
  font-size: 11px;
  color: var(--faint);
  font-weight: 400;
}

/* Task cards in Kanban & List with Drag-and-Drop */
.task-card {
  background: var(--card-solid);
  border: 1px solid var(--hair);
  border-left: 4px solid var(--faint);
  border-radius: var(--r-md, 13px);
  box-shadow: 0 2px 6px rgba(26, 18, 12, 0.04);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.task-card:active {
  cursor: grabbing;
}

.task-card.is-dragging {
  opacity: 0.45;
  transform: scale(0.98) rotate(-1deg);
  box-shadow: var(--shadow-pop);
}

.task-card.status-todo { border-left-color: var(--faint); }
.task-card.status-progress { border-left-color: var(--warm); }
.task-card.status-review { border-left-color: #7c3aed; }
.task-card.status-done { border-left-color: var(--good); }

.task-status-badge.status-todo {
  background: var(--sunk);
  color: var(--muted);
  border-color: var(--hair-strong);
}

.task-status-badge.status-progress {
  background: var(--warm-bg);
  color: var(--warm);
  border-color: rgba(180, 83, 9, 0.28);
}

.task-status-badge.status-review {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.3);
  font-weight: 600;
}

[data-theme="dark"] .task-status-badge.status-review {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.35);
}

.task-status-badge.status-done {
  background: var(--good-bg);
  color: var(--good);
  border-color: rgba(21, 128, 61, 0.28);
}

.task-drag-grip {
  color: var(--faint);
  font-size: 13px;
  line-height: 1;
  cursor: grab;
  user-select: none;
  margin-right: 4px;
  opacity: 0.65;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.task-card:hover .task-drag-grip {
  opacity: 1;
  color: var(--brand);
}

.task-card.is-kanban-card {
  padding: 12px 13px;
  gap: 10px;
}

.task-card.is-kanban-card .task-card-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.task-card.is-kanban-card .task-card-title {
  font-size: 13.5px;
  line-height: 1.38;
}

.task-card.is-kanban-card .task-card-desc {
  font-size: 12px;
  margin: 4px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card.is-kanban-card .task-card-actions {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.task-card.is-kanban-card:hover .task-card-actions {
  opacity: 1;
}

.tandem-recap-stat-pill.stat-review {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
}

[data-theme="dark"] .tandem-recap-stat-pill.stat-review {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.tandem-recap-item.is-review {
  border-left-color: #7c3aed;
}

/* ============================================================================
   TANDEM MOTION & BLOCKING ANIMATIONS (Tabs · Sidebar · Modals · Micro-Motion)
   ============================================================================ */

/* 1. Sliding Tab Blocking Pill (.tandem-tab-pill — Tandem .tabs__pill) */
.view-switchers,
.tasks-layout-switch,
.cal-view-switch,
.profile-tabs-nav,
.migration-subtabs-bar,
.md-editor-tabs,
.md-tabs {
  position: relative;
  isolation: isolate;
}

.tandem-tab-pill {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 99px;
  background: var(--act);
  box-shadow: 0 2px 8px rgba(26, 18, 12, 0.16);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform-origin: 50% 50%;
  will-change: transform, width, height;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.has-tandem-tab-pill > .btn-tab,
.has-tandem-tab-pill > .tasks-layout-btn,
.has-tandem-tab-pill > .cal-view-btn,
.has-tandem-tab-pill > .tab-btn,
.has-tandem-tab-pill > .migration-subtab-btn,
.has-tandem-tab-pill > .md-tab {
  position: relative;
  z-index: 1;
  transition: color 0.25s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.has-tandem-tab-pill > .btn-tab.active,
.has-tandem-tab-pill > .tasks-layout-btn.active,
.has-tandem-tab-pill > .cal-view-btn.active,
.has-tandem-tab-pill > .tab-btn.active,
.has-tandem-tab-pill > .migration-subtab-btn.active,
.has-tandem-tab-pill > .md-tab.active {
  background: transparent !important;
  box-shadow: none !important;
  border-color: transparent !important;
  color: var(--on-act) !important;
}

/* Profile Modal & Migration Subtabs Styled as Tandem Capsule Tab Bars */
.profile-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 10px 20px 0;
  padding: 4px;
  background: var(--sunk);
  border: 1px solid var(--hair);
  border-radius: 99px;
}

.profile-tabs-nav .tab-btn {
  padding: 7px 14px;
  border-radius: 99px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.profile-tabs-nav .tab-btn:hover:not(.active) {
  color: var(--ink);
}

.migration-subtabs-bar {
  background: var(--sunk) !important;
  border: 1px solid var(--hair) !important;
  border-radius: 99px !important;
  padding: 4px !important;
  gap: 4px !important;
  display: inline-flex !important;
  flex-wrap: wrap;
}

.migration-subtabs-bar .migration-subtab-btn {
  border-radius: 99px !important;
  background: transparent;
  border: none !important;
  color: var(--muted);
  font-weight: 600;
  padding: 7px 16px;
}

.migration-subtabs-bar .migration-subtab-btn:hover:not(.active) {
  color: var(--ink);
}

.md-editor-tabs,
.md-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--sunk);
  border: 1px solid var(--hair);
  border-radius: 99px;
  margin-bottom: 10px;
}

.md-editor-tabs .md-tab,
.md-tabs .md-tab {
  border-radius: 99px !important;
  border: none !important;
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  background: transparent;
}

.md-editor-tabs .md-editor-hint {
  margin-left: auto;
  padding: 0 12px 0 6px;
  font-size: 11.5px;
  color: var(--faint);
  position: relative;
  z-index: 1;
}

/* 2. Sliding Sidebar Blocking Pill (.tandem-side-pill — Tandem .side__pill) */
.sidebar .sidebar-menu {
  position: relative;
  isolation: isolate;
}

.tandem-side-pill {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 99px;
  background: var(--hl);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform-origin: 50% 50%;
  will-change: transform, width, height;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.sidebar .sidebar-menu.has-tandem-side-pill .nav-list {
  position: relative;
  z-index: 1;
}

.sidebar .sidebar-menu.has-tandem-side-pill .nav-item {
  position: relative;
  z-index: 1;
  transition: color 0.22s cubic-bezier(0.22, 1, 0.36, 1), transform 0.18s ease !important;
}

.sidebar .sidebar-menu.has-tandem-side-pill .nav-item:hover:not(.active) {
  background: rgba(34, 26, 20, 0.045) !important;
}

[data-theme="dark"] .sidebar .sidebar-menu.has-tandem-side-pill .nav-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.045) !important;
}

.sidebar .sidebar-menu.has-tandem-side-pill .nav-item.active {
  background: transparent !important;
  box-shadow: none !important;
  color: var(--hl-ink) !important;
  font-weight: 650;
}

.sidebar .sidebar-menu.has-tandem-side-pill .nav-item.active .nav-icon,
.sidebar .sidebar-menu.has-tandem-side-pill .nav-item.active .nav-icon-box,
.sidebar .sidebar-menu.has-tandem-side-pill .nav-item.active > svg {
  background: var(--card-solid) !important;
  border-color: transparent !important;
  color: var(--hl-ink) !important;
  box-shadow: 0 2px 6px rgba(34, 26, 20, 0.08);
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

/* Collapsed Sidebar overrides for Tandem Sidebar Pill */
.sidebar.collapsed .tandem-side-pill {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.sidebar.collapsed .sidebar-menu.has-tandem-side-pill .nav-item.active,
.sidebar.collapsed .nav-item.active {
  background: var(--hl) !important;
  color: var(--hl-ink) !important;
  box-shadow: 0 4px 12px rgba(24, 18, 13, 0.14) !important;
}

.sidebar.collapsed .sidebar-menu.has-tandem-side-pill .nav-item.active .nav-icon,
.sidebar.collapsed .sidebar-menu.has-tandem-side-pill .nav-item.active .nav-icon-box,
.sidebar.collapsed .sidebar-menu.has-tandem-side-pill .nav-item.active > svg,
.sidebar.collapsed .nav-item.active .nav-icon-box {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--hl-ink) !important;
  box-shadow: none !important;
}

/* 3. Modal, Card, Queue Item & Progress Fill Micro-Animations */
.modal-overlay {
  will-change: opacity;
}

.modal-card,
.float-win,
.compose-window {
  will-change: transform, opacity;
}

.mail-item {
  transition: background-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.mail-item:hover:not(.active) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.progress-bar-fill,
.quota-bar-fill,
#quota-bar,
#files-quota-bar,
#tasks-overall-bar,
.license-meter-fill {
  transform-origin: 0 50%;
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1),
              background-color 0.3s ease !important;
}

.toast {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  will-change: transform, opacity;
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(184, 74, 35, 0.25);
}

.toast.toast-error .toast-dot {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

/* ============================================================================
   MODERN BENTO CALENDAR & AGENDA WORKSPACE (Month / Week · Flags · Today Panel)
   ============================================================================ */
#section-calendar.cal-modern-section.active {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 6px 10px 18px;
}

.cal-modern-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
}

/* Top Hero Header Bar */
.cal-hero-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 2px 4px 0;
}

.cal-hero-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-hero-title {
  font-family: var(--font-sans) !important;
  font-size: clamp(28px, 2.7vw, 38px) !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
  line-height: 1.08 !important;
  color: var(--ink) !important;
  margin: 0 !important;
}

.cal-hero-sub {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 8px 2px;
}

.cal-hero-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* < Today > Capsule */
.cal-nav-capsule {
  display: inline-flex;
  align-items: center;
  height: 36px;
  background: var(--sunk);
  border: 1px solid var(--hair);
  border-radius: 99px;
  padding: 2px 4px;
  gap: 2px;
}

.cal-nav-arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.cal-nav-arrow:hover {
  background: var(--card-solid);
  color: var(--ink);
}

.cal-nav-today {
  padding: 0 12px;
  height: 30px;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 0.16s ease;
}

.cal-nav-today:hover {
  background: var(--card-solid);
}

/* Month | Week Segmented Switch */
.cal-view-switch {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 3px;
  background: var(--sunk);
  border: 1px solid var(--hair);
  border-radius: 99px;
  gap: 2px;
  position: relative;
  isolation: isolate;
}

.cal-view-switch > .tandem-tab-pill {
  background: var(--card-solid) !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1), 0 0 0 1px var(--hair) !important;
}

.cal-view-btn {
  position: relative;
  z-index: 1;
  height: 30px;
  padding: 0 14px;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: color 0.2s ease;
}

.cal-view-btn.active,
.has-tandem-tab-pill > .cal-view-btn.active {
  color: var(--ink) !important;
}

/* Glossy Blue "New event" Pill Button */
.cal-new-event-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border-radius: 99px;
  border: 1px solid #1d4ed8;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.cal-new-event-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.cal-secondary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1px solid var(--hair-strong);
  background: var(--card-solid);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.cal-secondary-pill:hover {
  background: var(--sunk);
  border-color: var(--faint);
}

.cal-report-inline-pill {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 2px 4px 2px 10px;
  border-radius: 99px;
  border: 1px solid var(--hair);
  background: var(--card-solid);
  gap: 4px;
}

.cal-report-date-input,
.cal-report-period-select {
  border: none !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  height: 28px !important;
  padding: 0 4px !important;
  outline: none !important;
  cursor: pointer;
}

.cal-report-go-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 99px;
  border: none;
  background: var(--sunk);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.cal-report-go-btn:hover {
  background: var(--act);
  color: var(--on-act);
}

/* Top-Right Floating Search & Action Pill */
.cal-hero-right {
  display: flex;
  align-items: center;
}

.cal-top-utility-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--card-solid);
  border: 1px solid var(--hair);
  border-radius: 99px;
  box-shadow: 0 6px 20px -10px rgba(26, 18, 12, 0.12);
}

.cal-search-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 12px;
  background: var(--sunk);
  border-radius: 99px;
  color: var(--faint);
  min-width: 210px;
}

.cal-search-box input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  color: var(--ink) !important;
  font-size: 13px !important;
  width: 100%;
}

.cal-search-box kbd {
  font-size: 10.5px;
  font-weight: 650;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--card-solid);
  border: 1px solid var(--hair);
  color: var(--faint);
}

.cal-util-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.16s ease;
}

.cal-util-icon-btn:hover {
  background: var(--sunk);
}

/* Two-Column Workspace: Left Board + Right Agenda Card */
.cal-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

.cal-board-card.calendar-main-pane {
  background: var(--card-solid) !important;
  border: 1px solid var(--hair) !important;
  border-radius: 26px !important;
  padding: 18px 20px 20px !important;
  box-shadow: 0 10px 30px -18px rgba(26, 18, 12, 0.12) !important;
  overflow: visible !important;
}

#section-calendar .calendar-view-container {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
}

#section-calendar .calendar-days-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  background: transparent !important;
  border: none !important;
  padding: 0 0 10px 0 !important;
}

#section-calendar .calendar-days-header > div {
  text-align: left !important;
  padding: 0 8px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--faint) !important;
}

#section-calendar .calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px !important;
  background: transparent !important;
  border: none !important;
}

#section-calendar .calendar-month-grid.is-week-view .calendar-day-cell {
  min-height: 420px !important;
}

#section-calendar .calendar-day-cell {
  min-height: 108px;
  padding: 10px 10px 8px !important;
  border-radius: 16px !important;
  background: var(--sunk) !important;
  border: 2px solid transparent !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease !important;
}

#section-calendar .calendar-day-cell:hover {
  background: color-mix(in srgb, var(--sunk) 75%, var(--card-solid)) !important;
}

#section-calendar .calendar-day-cell.other-month {
  background: transparent !important;
  opacity: 0.55;
}

#section-calendar .calendar-day-cell.other-month:hover {
  background: var(--sunk) !important;
  opacity: 0.85;
}

#section-calendar .calendar-day-cell.is-selected {
  background: var(--card-solid) !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 8px 22px -10px rgba(59, 130, 246, 0.32) !important;
  opacity: 1;
}

.cal-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 24px;
}

#section-calendar .calendar-day-cell .day-number {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  width: auto;
  height: auto;
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

#section-calendar .calendar-day-cell.today .day-number {
  background: #2563eb !important;
  color: #ffffff !important;
  width: 26px;
  height: 26px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.cal-cell-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cal-more-count {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--faint);
  white-space: nowrap;
}

/* Colored Flag Badges on Day Cells */
.cal-flag-badge {
  width: 21px;
  height: 21px;
  border-radius: 6px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cal-flag-badge:hover {
  transform: scale(1.12);
}

.cal-flag-badge.flag-blue { background: #dbeafe; color: #2563eb; }
.cal-flag-badge.flag-purple { background: #ede9fe; color: #7c3aed; }
.cal-flag-badge.flag-green { background: #dcfce7; color: #16a34a; }
.cal-flag-badge.flag-pink { background: #fce7f3; color: #db2777; }
.cal-flag-badge.flag-amber { background: #fef3c7; color: #d97706; }

[data-theme="dark"] .cal-flag-badge.flag-blue { background: rgba(59, 130, 246, 0.22); color: #93c5fd; }
[data-theme="dark"] .cal-flag-badge.flag-purple { background: rgba(139, 92, 246, 0.22); color: #c4b5fd; }
[data-theme="dark"] .cal-flag-badge.flag-green { background: rgba(34, 197, 94, 0.22); color: #86efac; }
[data-theme="dark"] .cal-flag-badge.flag-pink { background: rgba(236, 72, 153, 0.22); color: #f9a8d4; }
[data-theme="dark"] .cal-flag-badge.flag-amber { background: rgba(245, 158, 11, 0.22); color: #fcd34d; }

/* Pastel Event Pills with Vertical Left Accent Bar */
#section-calendar .cell-events-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#section-calendar .calendar-event-pill {
  position: relative;
  display: flex;
  align-items: center;
  padding: 3px 7px 3px 10px !important;
  border-radius: 6px !important;
  border: none !important;
  font-size: 11px !important;
  font-weight: 650 !important;
  line-height: 1.3 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

#section-calendar .calendar-event-pill::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  bottom: 4px;
  width: 2.5px;
  border-radius: 99px;
  background: currentColor;
}

#section-calendar .calendar-event-pill:hover {
  filter: brightness(0.96);
}

#section-calendar .calendar-event-pill .pill-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#section-calendar .calendar-event-pill.pill-theme-blue {
  background: #dbeafe !important;
  color: #1e40af !important;
}
#section-calendar .calendar-event-pill.pill-theme-blue::before { background: #2563eb; }

#section-calendar .calendar-event-pill.pill-theme-pink {
  background: #fce7f3 !important;
  color: #9d174d !important;
}
#section-calendar .calendar-event-pill.pill-theme-pink::before { background: #ec4899; }

#section-calendar .calendar-event-pill.pill-theme-green {
  background: #dcfce7 !important;
  color: #166534 !important;
}
#section-calendar .calendar-event-pill.pill-theme-green::before { background: #10b981; }

#section-calendar .calendar-event-pill.pill-theme-amber {
  background: #ffedd5 !important;
  color: #9a3412 !important;
}
#section-calendar .calendar-event-pill.pill-theme-amber::before { background: #f97316; }

#section-calendar .calendar-event-pill.pill-theme-purple {
  background: #ede9fe !important;
  color: #5b21b6 !important;
}
#section-calendar .calendar-event-pill.pill-theme-purple::before { background: #8b5cf6; }

[data-theme="dark"] #section-calendar .calendar-event-pill.pill-theme-blue {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #bfdbfe !important;
}
[data-theme="dark"] #section-calendar .calendar-event-pill.pill-theme-pink {
  background: rgba(236, 72, 153, 0.2) !important;
  color: #fbcfe8 !important;
}
[data-theme="dark"] #section-calendar .calendar-event-pill.pill-theme-green {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #a7f3d0 !important;
}
[data-theme="dark"] #section-calendar .calendar-event-pill.pill-theme-amber {
  background: rgba(249, 115, 22, 0.2) !important;
  color: #fed7aa !important;
}
[data-theme="dark"] #section-calendar .calendar-event-pill.pill-theme-purple {
  background: rgba(139, 92, 246, 0.22) !important;
  color: #ddd6fe !important;
}

/* Right Column: Selected Day Agenda & Due Today Card */
.cal-agenda-card {
  background: var(--card-solid);
  border: 1px solid var(--hair);
  border-radius: 26px;
  padding: 22px 20px;
  box-shadow: 0 10px 30px -18px rgba(26, 18, 12, 0.12);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 6px;
}

.cal-agenda-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cal-agenda-title {
  font-family: var(--font-sans) !important;
  font-size: 21px !important;
  font-weight: 750 !important;
  letter-spacing: -0.02em !important;
  color: var(--ink) !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

.cal-agenda-sub {
  font-size: 12.5px;
  color: var(--faint);
  font-weight: 500;
  margin: 2px 0 0;
}

.cal-agenda-add-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1px solid var(--hair-strong);
  background: var(--card-solid);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.cal-agenda-add-btn:hover {
  background: var(--sunk);
  border-color: var(--faint);
}

/* Red Live Time Indicator Line */
.cal-now-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
}

.cal-now-time {
  font-size: 11px;
  font-weight: 700;
  color: #ef4444;
  white-space: nowrap;
  min-width: 54px;
}

.cal-now-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
}

.cal-now-line {
  flex: 1;
  height: 1.5px;
  background: #ef4444;
  border-radius: 99px;
}

/* Selected Day Timeline Items */
.cal-agenda-events {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cal-agenda-empty {
  padding: 20px 14px;
  border-radius: 14px;
  background: var(--sunk);
  border: 1px dashed var(--hair-strong);
  text-align: center;
}

.cal-agenda-empty p {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 4px;
}

.cal-agenda-empty span {
  font-size: 11.5px;
  color: var(--faint);
}

.cal-agenda-item {
  display: grid;
  grid-template-columns: 64px 4px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  cursor: pointer;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 14px;
  transition: background-color 0.16s ease;
}

.cal-agenda-item:hover {
  background: var(--sunk);
}

.cal-agenda-time-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 1px;
}

.cal-agenda-start {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cal-agenda-dur {
  font-size: 11.5px;
  color: var(--faint);
  font-weight: 500;
}

.cal-agenda-bar {
  width: 3.5px;
  border-radius: 99px;
  background: #3b82f6;
}

.cal-agenda-bar.bar-blue { background: #3b82f6; }
.cal-agenda-bar.bar-pink { background: #ec4899; }
.cal-agenda-bar.bar-green { background: #10b981; }
.cal-agenda-bar.bar-amber { background: #f59e0b; }
.cal-agenda-bar.bar-purple { background: #8b5cf6; }

.cal-agenda-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cal-agenda-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-word;
}

.cal-agenda-loc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.cal-agenda-video-link {
  color: inherit;
  text-decoration: none;
}

.cal-agenda-video-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.cal-agenda-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

/* Stacked Circular Participant Avatars */
.cal-avatar-stack {
  display: inline-flex;
  align-items: center;
}

.cal-mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: oklch(0.86 0.08 var(--av-h, 220));
  color: oklch(0.32 0.09 var(--av-h, 220));
  border: 2px solid var(--card-solid);
  font-size: 9.5px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: -6px;
}

.cal-mini-avatar:first-child {
  margin-left: 0;
}

.cal-mini-avatar-more {
  background: var(--sunk);
  color: var(--muted);
  font-size: 9.5px;
  padding: 0 5px;
  width: auto;
  min-width: 22px;
  border-radius: 99px;
}

/* Category Chip inside Agenda Item */
.cal-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 650;
}

.cal-category-chip.chip-blue { background: #dbeafe; color: #1e40af; }
.cal-category-chip.chip-pink { background: #fce7f3; color: #9d174d; }
.cal-category-chip.chip-green { background: #dcfce7; color: #166534; }
.cal-category-chip.chip-amber { background: #fef3c7; color: #9a3412; }
.cal-category-chip.chip-purple { background: #ede9fe; color: #5b21b6; }

[data-theme="dark"] .cal-category-chip.chip-blue { background: rgba(59, 130, 246, 0.2); color: #bfdbfe; }
[data-theme="dark"] .cal-category-chip.chip-pink { background: rgba(236, 72, 153, 0.2); color: #fbcfe8; }
[data-theme="dark"] .cal-category-chip.chip-green { background: rgba(16, 185, 129, 0.2); color: #a7f3d0; }
[data-theme="dark"] .cal-category-chip.chip-amber { background: rgba(245, 158, 11, 0.2); color: #fde68a; }
[data-theme="dark"] .cal-category-chip.chip-purple { background: rgba(139, 92, 246, 0.22); color: #ddd6fe; }

/* "Due today" Tasks Section at Bottom of Agenda Card */
.cal-due-section {
  border-top: 1px solid var(--hair);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cal-due-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cal-due-head-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cal-due-title {
  font-size: 14px;
  font-weight: 750;
  color: var(--ink);
}

.cal-due-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--sunk);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-due-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-due-link-btn {
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--hair);
  background: var(--sunk);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cal-due-link-btn:hover {
  background: var(--act);
  color: var(--on-act);
}

.cal-due-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-due-empty {
  font-size: 12px;
  color: var(--faint);
  padding: 6px 0;
}

.cal-due-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 12px;
  transition: background-color 0.15s ease;
}

.cal-due-item:hover {
  background: var(--sunk);
}

.cal-due-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.8px solid var(--hair-strong);
  background: transparent;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.16s ease;
}

.cal-due-check:hover {
  border-color: #3b82f6;
}

.cal-due-check.checked {
  background: #10b981;
  border-color: #10b981;
}

.cal-due-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.cal-due-item-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.3;
}

.cal-due-item.is-done .cal-due-item-title {
  text-decoration: line-through;
  color: var(--faint);
}

.cal-due-item-sub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.cal-due-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

@media (max-width: 1200px) {
  .tasks-kanban-board {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
  .cal-workspace-grid {
    grid-template-columns: 1fr;
  }
  .cal-agenda-card {
    position: static;
  }
}

@media (max-width: 768px) {
  .tasks-kanban-board {
    grid-template-columns: 1fr;
  }
  .profile-tabs-nav {
    border-radius: 16px;
  }
  .cal-search-box {
    min-width: 140px;
  }
  #section-calendar .calendar-day-cell {
    min-height: 76px;
    padding: 6px !important;
  }
  .layout-body {
    padding: 0;
    gap: 0;
  }
  .mail-list-pane,
  .mail-detail-pane,
  .admin-content-pane,
  .calendar-main-pane,
  .notes-main-pane,
  .files-main-pane {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
  }
  .brand-hub-tag {
    display: none;
  }
}




