/* Phantom Design System */

:root {
  /* Deep space palette */
  --bg-void: #050816;
  --bg-deep: #0A0E23;
  --bg-layer-1: rgba(15, 20, 50, 0.6);
  --bg-layer-2: rgba(20, 28, 65, 0.4);
  --bg-glass: rgba(16, 22, 55, 0.55);
  --bg-glass-hover: rgba(22, 30, 70, 0.65);
  --bg-glass-strong: rgba(20, 28, 65, 0.75);
  --bg-input: rgba(10, 15, 40, 0.6);
  --bg-inset: rgba(255, 255, 255, 0.03);
  --text-primary: #E4E8F7;
  --text-secondary: #8892B5;
  --text-tertiary: #505A7E;
  --text-bright: #FFFFFF;
  --border-glass: rgba(100, 130, 255, 0.08);
  --border-glow: rgba(80, 120, 255, 0.15);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --blue: #4F8EFF;
  --blue-bright: #6BA3FF;
  --blue-soft: rgba(79, 142, 255, 0.12);
  --blue-glow: rgba(79, 142, 255, 0.2);
  --cyan: #22D3EE;
  --cyan-soft: rgba(34, 211, 238, 0.1);
  --green: #34D399;
  --green-soft: rgba(52, 211, 153, 0.1);
  --purple: #38BDF8;
  --purple-soft: rgba(56, 189, 248, 0.1);
  --amber: #FBBF24;
  --amber-soft: rgba(251, 191, 36, 0.1);
  --red: #F87171;
  --red-soft: rgba(248, 113, 113, 0.1);
  --teal: #2DD4BF;
  --teal-soft: rgba(45, 212, 191, 0.1);
  --glass-blur: 24px;
  --glass-border: rgba(100, 140, 255, 0.1);
  --glow-sm: 0 0 20px rgba(79, 142, 255, 0.06);
  --glow-md: 0 4px 30px rgba(79, 142, 255, 0.08);
  --glow-lg: 0 8px 50px rgba(79, 142, 255, 0.12);
  --glow-accent: 0 0 30px rgba(79, 142, 255, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-elevated: 0 12px 48px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  --radius: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
}

/* Light mode */
[data-theme="light"] {
  --bg-void: #EEF1F8;
  --bg-deep: #F4F6FB;
  --bg-layer-1: rgba(255, 255, 255, 0.7);
  --bg-layer-2: rgba(255, 255, 255, 0.5);
  --bg-glass: rgba(255, 255, 255, 0.65);
  --bg-glass-hover: rgba(255, 255, 255, 0.8);
  --bg-glass-strong: rgba(255, 255, 255, 0.85);
  --bg-input: rgba(0, 0, 0, 0.03);
  --bg-inset: rgba(0, 0, 0, 0.03);
  --text-primary: #0F1629;
  --text-secondary: #5B6485;
  --text-tertiary: #9CA3BE;
  --text-bright: #0F1629;
  --border-glass: rgba(0, 50, 150, 0.06);
  --border-glow: rgba(79, 142, 255, 0.12);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --glass-border: rgba(0, 50, 150, 0.08);
  --glow-sm: 0 0 20px rgba(79, 142, 255, 0.04);
  --glow-md: 0 4px 30px rgba(79, 142, 255, 0.06);
  --glow-lg: 0 8px 50px rgba(79, 142, 255, 0.08);
  --glow-accent: 0 0 30px rgba(79, 142, 255, 0.1);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg-void);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.5s ease;
  padding-bottom: 60px; /* Space for Phantom bar */
}

/* ─── Ambient Lighting ─── */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  animation: drift 20s ease-in-out infinite;
}

.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(79, 142, 255, 0.15) 0%, transparent 70%);
  top: -10%; left: 10%;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
  bottom: -5%; right: 5%;
  animation-delay: -7s;
}

.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.08) 0%, transparent 70%);
  top: 40%; left: 50%;
  animation-delay: -14s;
}

[data-theme="light"] .ambient-orb { opacity: 0.4; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ─── Sidebar ─── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 248px;
  background: var(--bg-glass);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: background 0.5s;
}

.sidebar-brand {
  padding: 22px 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-glyph {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(79, 142, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
}

.brand-glyph::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 11px;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 1px;
}

.brand-glyph svg { width: 16px; height: 16px; color: white; position: relative; z-index: 1; }

.brand-glyph img {
  background: none !important;
  box-shadow: none !important;
}

.brand-glyph:has(img) {
  background: none !important;
  box-shadow: none !important;
}

.brand-glyph:has(img)::after {
  display: none;
}

.brand-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.sidebar-nav {
  padding: 4px 8px;
  flex: 1;
  overflow-y: auto;
}

.nav-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 16px 10px 5px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

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

.nav-link.active {
  background: var(--blue-soft);
  color: var(--blue-bright);
  box-shadow: var(--glow-sm);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 16px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(79, 142, 255, 0.4);
}

.nav-ico {
  width: 18px; height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.nav-link.active .nav-ico { opacity: 1; }

.nav-ico svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 8px;
  min-width: 18px;
  text-align: center;
}

.badge-alert { background: var(--red); color: white; }
.badge-dim { background: var(--bg-inset); color: var(--text-tertiary); border: 1px solid var(--border-subtle); }

.inst-dot {
  width: 7px; height: 7px;
  border-radius: 3px;
  flex-shrink: 0;
}

.sidebar-bottom {
  padding: 10px 8px 14px;
  border-top: 1px solid var(--glass-border);
}

.theme-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-tertiary);
  background: none;
  border: none;
  width: 100%;
  font-family: inherit;
  transition: all 0.15s;
  margin-bottom: 4px;
}

.theme-btn:hover { background: var(--bg-glass-hover); color: var(--text-secondary); }

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
}

.user-av {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(79, 142, 255, 0.25);
}

.user-name { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.user-loc { font-size: 10.5px; color: var(--text-tertiary); }

/* ─── Main ─── */
.main {
  margin-left: 248px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ─── Top Bar ─── */
.topbar {
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-glass);
  backdrop-filter: blur(30px) saturate(1.3);
  -webkit-backdrop-filter: blur(30px) saturate(1.3);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.5s;
}

.greeting {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.greeting-sub {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-top: 1px;
  font-weight: 400;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  background: var(--bg-glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 0 16px rgba(52, 211, 153, 0.8); }
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  background: linear-gradient(135deg, var(--blue), #22D3EE);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 12px rgba(79, 142, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(79, 142, 255, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}

/* ─── Content ─── */
.content-wrapper {
  padding: 24px 32px 120px;
}

.content {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 20px;
}

.col-l { display: flex; flex-direction: column; gap: 18px; }
.col-r { display: flex; flex-direction: column; gap: 18px; }

/* ─── Glass Card ─── */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: all 0.4s;
  position: relative;
  overflow: visible;
}

/* Subtle top-edge highlight */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 20px; right: 20px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(100, 160, 255, 0.15), transparent);
  z-index: 1;
}

.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-card), var(--glow-sm);
}

.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px 11px;
  position: relative;
  z-index: 1;
}

.card-t {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.1px;
}

.ct-icon {
  width: 22px; height: 22px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.ci-blue { background: var(--blue-soft); color: var(--blue); border: 1px solid rgba(79,142,255,0.1); }
.ci-purple { background: var(--purple-soft); color: var(--purple); border: 1px solid rgba(56,189,248,0.1); }
.ci-green { background: var(--green-soft); color: var(--green); border: 1px solid rgba(52,211,153,0.1); }
.ci-cyan { background: var(--cyan-soft); color: var(--cyan); border: 1px solid rgba(34,211,238,0.1); }

.card-btn {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-weight: 500;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  font-family: inherit;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-block;
}

.card-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 12px rgba(79,142,255,0.1);
}

/* Form elements containing card-btn should display inline */
form:has(.card-btn) {
  display: inline-block;
  margin: 0;
}

form .card-btn {
  text-decoration: none;
}

/* ─── Scores ─── */
.scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 18px 12px;
}

.score {
  background: var(--bg-layer-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  transition: all 0.25s;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.score::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 50%);
  pointer-events: none;
}

.score:hover {
  border-color: var(--border-glow);
  box-shadow: var(--glow-sm);
  transform: translateY(-1px);
}

.score-n {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.sc-blue { color: var(--blue-bright); }
.sc-green { color: var(--green); }
.sc-purple { color: var(--purple); }
.sc-cyan { color: var(--cyan); }

.score-l {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-tertiary);
  margin-top: 5px;
  position: relative;
  z-index: 1;
}

/* ─── XP ─── */
.xp { padding: 0 18px 14px; }

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

.xp-lbl {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--blue);
  font-family: 'JetBrains Mono', monospace;
}

.xp-track {
  flex: 1; height: 4px;
  background: var(--bg-layer-1);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--teal));
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(79,142,255,0.3);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-num {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Tasks ─── */
.tasks { padding: 0 6px 8px; }

.task {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: all 0.15s;
}

.task:hover { background: var(--bg-glass-hover); }
.task.bold .t-name { font-weight: 800; color: #FCD34D; }
.task.done .t-name { text-decoration: line-through; color: var(--text-tertiary); }

.t-grip {
  display: flex; flex-direction: column; gap: 1.5px; padding-top: 5px;
  opacity: 0; transition: opacity 0.15s; color: var(--text-tertiary);
}
.task:hover .t-grip { opacity: 0.4; }
.grip-r { display: flex; gap: 1.5px; }
.grip-d { width: 2.5px; height: 2.5px; background: currentColor; border-radius: 50%; }

.t-check {
  width: 17px; height: 17px;
  border: 1.5px solid var(--border-glow);
  border-radius: 5px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: all 0.2s;
  background: var(--bg-layer-1);
  padding: 0;
}

.t-check form {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
}

.t-check:hover {
  border-color: var(--blue);
  box-shadow: 0 0 10px rgba(79,142,255,0.2);
}

.task.done .t-check {
  background: linear-gradient(135deg, var(--green), var(--teal));
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(52,211,153,0.3);
}

.t-check svg { width: 10px; height: 10px; opacity: 0; color: white; stroke-width: 3; }
.task.done .t-check svg { opacity: 1; }

.t-body { flex: 1; min-width: 0; }
.t-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.35;
  cursor: pointer;
  transition: color 0.15s;
}

.t-name:hover {
  color: var(--blue-bright);
}

.t-meta { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; align-items: center; }

.t-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 4px;
  letter-spacing: 0.2px;
}

.tt-inter { background: var(--blue-soft); color: var(--blue-bright); }
.tt-parrot { background: var(--green-soft); color: var(--green); }
.tt-owl { background: rgba(244,114,182,0.1); color: #EC4899; }
.tt-emu { background: var(--amber-soft); color: var(--amber); }
.tt-personal { background: var(--cyan-soft); color: var(--cyan); }
.tt-proj { background: var(--bg-inset); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.tt-inbox {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}
.tt-inbox:hover {
  background: rgba(59, 130, 246, 0.25);
  color: var(--blue-bright);
}

.t-time {
  font-size: 10px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}

.t-acts {
  display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; padding-top: 2px;
}
.task:hover .t-acts { opacity: 1; }

.t-acts form {
  display: inline;
  margin: 0;
  padding: 0;
}

.t-btn {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; color: var(--text-tertiary);
  border-radius: var(--radius-xs); cursor: pointer;
  font-size: 11px; font-weight: 600; font-family: inherit;
  transition: all 0.15s;
}

.t-btn:hover { background: var(--bg-glass); color: var(--text-primary); }
.t-btn.on { color: var(--blue); }
.t-btn, .t-check { text-decoration: none; }

.t-sep { height: 1px; background: var(--border-subtle); margin: 1px 12px; }

/* Push menu dropdown */
.t-push-menu {
  position: relative;
}

.push-dropdown {
  position: absolute;
  right: 0;
  bottom: 100%;
  margin-bottom: 4px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
  z-index: 100;
  min-width: 120px;
}

.push-item {
  display: block;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

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

/* Task Quick Actions */
.task-quick-actions {
  margin-top: 8px;
}

.task-qa-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.task-qa-toggle:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

.task-qa-toggle.active {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: rgba(79, 142, 255, 0.3);
}

.task-qa-content {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.push-item + .push-item {
  border-top: 1px solid var(--border-subtle);
}

.push-dropdown form {
  display: block;
  margin: 0;
  padding: 0;
}

.push-dropdown form + form {
  border-top: 1px solid var(--border-subtle);
}

.handle {
  cursor: grab;
}

.handle:active {
  cursor: grabbing;
}

.task-ghost {
  opacity: 0.4;
}

.task-drag {
  background: var(--bg-glass-strong);
  box-shadow: var(--shadow-elevated);
}

/* ─── Inbox ─── */
.inbox-container {
  display: flex;
  gap: 20px;
  height: calc(100vh - 120px);
  overflow: hidden;
}

.inbox-list-panel {
  flex: 0 0 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-list-panel.has-detail {
  flex: 0 0 420px;
}

.inbox-list-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.inbox-detail-panel {
  flex: 1;
  background: var(--bg-layer-0);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 24px;
}

.inbox-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.inbox-detail-empty .empty-state {
  text-align: center;
  color: var(--text-tertiary);
}

.inbox-detail-empty .empty-state svg {
  opacity: 0.3;
  margin-bottom: 16px;
}

.inbox-detail-empty .empty-state p {
  font-size: 13px;
}

.inbox-list {
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}

/* Responsive: Hide list panel on mobile when viewing message */
@media (max-width: 768px) {
  .inbox-container {
    height: auto;
    min-height: calc(100vh - 120px);
  }

  .inbox-list-panel {
    flex: 1;
  }

  .inbox-list-panel.has-detail {
    display: none;
  }

  .inbox-detail-panel {
    width: 100%;
  }
}

.inbox-row {
  padding: 11px 18px;
  display: flex;
  gap: 11px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.inbox-row:hover { background: var(--bg-glass-hover); }
.inbox-row:last-child { border-bottom: none; }

/* Selected message highlight */
.inbox-row.is-selected {
  background: rgba(251, 191, 36, 0.08);
  border-left: 3px solid var(--amber);
  padding-left: 15px;
}

[data-theme="light"] .inbox-row.is-selected {
  background: rgba(251, 191, 36, 0.12);
}

.inbox-row.is-selected:hover {
  background: rgba(251, 191, 36, 0.12);
}

[data-theme="light"] .inbox-row.is-selected:hover {
  background: rgba(251, 191, 36, 0.16);
}

/* Unread message styling */
.inbox-row.is-unread {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--blue);
  padding-left: 15px;
}

[data-theme="light"] .inbox-row.is-unread {
  background: rgba(59, 130, 246, 0.12);
  border-left: 3px solid var(--blue);
}

.inbox-row.is-unread:hover {
  background: rgba(59, 130, 246, 0.12);
}

[data-theme="light"] .inbox-row.is-unread:hover {
  background: rgba(59, 130, 246, 0.16);
}

.inbox-row.is-unread .in-from {
  font-weight: 700;
  color: var(--text-primary);
}

.inbox-row.is-unread .in-preview {
  font-weight: 600;
  color: var(--text-primary);
}

.unread-indicator {
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--blue);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  transition: opacity 0.2s, transform 0.2s;
}

/* Compact Inbox Filters */
.inbox-filters-compact {
  padding: 12px;
}

.inbox-tabs-compact {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.inbox-tab-compact {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  font-family: inherit;
}

.inbox-tab-compact:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.inbox-tab-compact.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.inbox-tab-compact .tab-count {
  opacity: 0.6;
  font-size: 10px;
  margin-left: 4px;
}

.inbox-tab-compact .tab-unread-count {
  background: var(--blue);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 4px;
  min-width: 18px;
  text-align: center;
  display: inline-block;
}

.inbox-filters-row {
  display: flex;
  gap: 6px;
}

.filter-select-compact,
.filter-search-compact {
  font-size: 11px;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-layer-1);
  color: var(--text-primary);
  font-family: inherit;
}

.filter-select-compact {
  flex: 1;
}

.filter-search-compact {
  flex: 1.5;
}

.filter-search-compact::placeholder {
  color: var(--text-tertiary);
}

.in-src {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 13px;
}

.is-slack { background: rgba(74, 21, 75, 0.15); }
.is-gmail { background: rgba(234, 67, 53, 0.12); }
.is-support { background: var(--purple-soft); }

.in-body { flex: 1; min-width: 0; }
.in-from {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.in-from > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.in-preview { font-size: 12px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.in-time { font-size: 10.5px; color: var(--text-tertiary); font-family: 'JetBrains Mono', monospace; }

.thread-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}

.in-pills { display: flex; gap: 4px; margin-top: 7px; }

.pill {
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-layer-1);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}

.pill:hover { border-color: var(--blue); color: var(--blue); }

.pill-ai {
  background: linear-gradient(135deg, var(--blue-soft), var(--cyan-soft));
  border: 1px solid rgba(79, 142, 255, 0.12);
  color: var(--blue-bright);
}

.pill-ai:hover {
  box-shadow: 0 0 16px rgba(79,142,255,0.15);
}

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

.pill-dropdown {
  position: relative;
  display: inline-block;
}

.pill-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 1000;
  min-width: 120px;
  padding: 4px;
}

.pill-menu button {
  display: block;
  width: 100%;
  padding: 6px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-menu button:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

/* ─── Week Strip ─── */
.week {
  display: flex; gap: 3px; padding: 0 18px 14px;
}

.wd {
  flex: 1; text-align: center; padding: 8px 0;
  border-radius: var(--radius-xs); cursor: pointer;
  transition: all 0.2s; position: relative;
}

.wd:hover { background: var(--bg-glass-hover); }

.wd-d {
  font-size: 9.5px; font-weight: 500; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--text-tertiary);
}

.wd-n {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary); margin-top: 1px;
}

.wd.now {
  background: linear-gradient(135deg, var(--blue), #22D3EE);
  box-shadow: 0 2px 12px rgba(79, 142, 255, 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}

.wd.now .wd-d, .wd.now .wd-n { color: white; }

.wd.has::after {
  content: ''; display: block; width: 3px; height: 3px;
  border-radius: 50%; background: var(--blue);
  margin: 3px auto 0; box-shadow: 0 0 4px rgba(79,142,255,0.4);
}

.wd.now.has::after { background: white; box-shadow: none; }

/* ─── Progress ─── */
.prog-item { padding: 11px 18px; }
.prog-item + .prog-item { border-top: 1px solid var(--border-subtle); }

.prog-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.prog-lbl { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); }
.prog-val { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500; color: var(--text-primary); }

.prog-track {
  height: 4px; background: var(--bg-layer-1);
  border-radius: 2px; overflow: hidden; border: 1px solid var(--border-subtle);
}

.prog-bar {
  height: 100%; border-radius: 2px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.pb-blue {
  background: linear-gradient(90deg, var(--blue), #60A5FA);
  box-shadow: 0 0 8px rgba(79,142,255,0.3);
}

.pb-green {
  background: linear-gradient(90deg, var(--green), var(--cyan));
  box-shadow: 0 0 8px rgba(52,211,153,0.3);
}

.pb-purple {
  background: linear-gradient(90deg, var(--purple), #67E8F9);
  box-shadow: 0 0 8px rgba(56,189,248,0.3);
}

.prog-note { font-size: 10.5px; color: var(--text-tertiary); margin-top: 5px; }
.prog-note .up { color: var(--green); font-weight: 600; }

/* ─── Activity ─── */
.act { padding: 7px 18px; display: flex; gap: 8px; align-items: flex-start; }
.act-t { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-tertiary); min-width: 36px; padding-top: 2px; }

.act-d {
  width: 5px; height: 5px; border-radius: 50%; margin-top: 5px; flex-shrink: 0;
}

.ad-ok { background: var(--green); box-shadow: 0 0 6px rgba(52,211,153,0.4); }
.ad-warn { background: var(--amber); box-shadow: 0 0 6px rgba(251,191,36,0.4); }
.ad-alert { background: var(--red); box-shadow: 0 0 6px rgba(248,113,113,0.4); }
.ad-info { background: var(--blue); box-shadow: 0 0 6px rgba(79,142,255,0.4); }

.act-x { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.act-x strong { color: var(--text-primary); font-weight: 600; }

/* ─── Copilot ─── */
.copilot {
  position: fixed;
  bottom: 18px;
  left: calc(248px + 32px);
  right: 32px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(30px) saturate(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 5px 5px 5px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-elevated), var(--glow-md);
  z-index: 200;
  transition: all 0.3s;
}

.copilot:focus-within {
  border-color: var(--blue);
  box-shadow: var(--shadow-elevated), var(--glow-accent);
}

.cp-glyph {
  width: 20px; height: 20px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(79,142,255,0.3);
}

.cp-glyph svg { width: 10px; height: 10px; color: white; }

.cp-input {
  flex: 1; border: none; background: none;
  font-family: inherit; font-size: 13px;
  color: var(--text-primary); outline: none;
}

.cp-input::placeholder { color: var(--text-tertiary); }

.cp-kbd {
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-tertiary);
  padding: 3px 7px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
}

.cp-send {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--blue), #22D3EE);
  border: none; border-radius: 8px;
  color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(79, 142, 255, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.cp-send:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79, 142, 255, 0.4); }
.cp-send svg { width: 13px; height: 13px; }

/* ─── Animations ─── */
.card { animation: cardIn 0.6s ease both; }
.col-l .card:nth-child(1) { animation-delay: 0s; }
.col-l .card:nth-child(2) { animation-delay: 0.08s; }
.col-l .card:nth-child(3) { animation-delay: 0.16s; }
.col-r .card:nth-child(1) { animation-delay: 0.04s; }
.col-r .card:nth-child(2) { animation-delay: 0.12s; }
.col-r .card:nth-child(3) { animation-delay: 0.2s; }

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

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 2px; }

/* Alerts */
.notice, .alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}

.notice {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.alert {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ─── Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1001;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(30px) saturate(1.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated), var(--glow-md);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.modal-close:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ─── Forms ─── */

/* Global form field styling */
.select-field,
input[type="text"].select-field,
input[type="email"].select-field,
input[type="number"].select-field,
select.select-field,
textarea.select-field {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: all 0.2s;
  box-sizing: border-box;
}

.select-field:focus,
input.select-field:focus,
select.select-field:focus,
textarea.select-field:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  background: var(--bg-glass);
}

.select-field:disabled,
input.select-field:disabled,
select.select-field:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.task-form .form-field {
  margin-bottom: 16px;
}

.task-form label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.task-form input[type="text"],
.task-form input[type="number"],
.task-form textarea,
.task-form select,
.task-form .select-field {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: all 0.2s;
}

.task-form input:focus,
.task-form textarea:focus,
.task-form select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  background: var(--bg-glass);
}

.task-form textarea {
  resize: vertical;
  min-height: 60px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-glass-hover);
  border-color: var(--blue);
  color: var(--blue);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Toast Notifications ─── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  min-width: 200px;
  max-width: 400px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  border-left: 3px solid var(--green);
}

.toast-error {
  border-left: 3px solid var(--red);
}

.toast-info {
  border-left: 3px solid var(--blue);
}

.toast-warning {
  border-left: 3px solid var(--yellow);
}

/* ─── Radio Group ─── */
.assignee-radio-group {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  transition: color 0.2s;
}

.radio-label:hover {
  color: var(--text-primary);
}

.radio-label input[type="radio"] {
  cursor: pointer;
  accent-color: var(--blue);
}

.assignee-field {
  margin-top: 12px;
}

/* ─── Waiting Tag ─── */
.tt-waiting {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--yellow);
}

/* ─── Assign Modal ─── */
.assign-modal {
  max-width: 420px;
}

.assign-modal .modal-body {
  padding: 20px 24px 24px;
}

/* ─── Edit Task Modal ─── */
.edit-task-modal {
  max-width: 560px;
  width: 90%;
}

.edit-task-modal .modal-body {
  padding: 20px 16px 24px;
  width: 100%;
  box-sizing: border-box;
}

/* ─── Task Button Icons ─── */
.t-btn svg {
  width: 14px;
  height: 14px;
}

.t-star svg {
  width: 14px;
  height: 14px;
}

.t-star.on {
  color: var(--yellow);
}

.task.bold .t-name {
  font-weight: 800;
  color: #FCD34D;
}

.task.bold::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--yellow);
  border-radius: 2px 0 0 2px;
}

/* ─── Modal Overlay for Alpine Modals ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay .modal {
  position: relative;
  inset: auto;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(30px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 500px;
  width: 90%;
  animation: slideUp 0.3s ease;
}

/* ─── Assign Modal Specific Styles ─── */
.assign-modal .modal-title {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
}

.assign-modal .form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.assign-modal .select-field,
.assign-modal input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: all 0.2s;
}

.assign-modal .select-field:focus,
.assign-modal input[type="text"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 142, 255, 0.1);
  background: var(--bg-glass);
}

.assign-modal .select-field {
  cursor: pointer;
}

/* ─── Edit Task Modal Form Fields ─── */
.edit-task-modal .modal-title {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
}

.edit-task-modal .form-field {
  margin-bottom: 16px;
}

.edit-task-modal .form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edit-task-modal .select-field,
.edit-task-modal textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: all 0.2s;
}

.edit-task-modal .select-field:focus,
.edit-task-modal textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 142, 255, 0.1);
  background: var(--bg-glass);
}

.edit-task-modal .select-field:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.edit-task-modal .modal-body .modal-title {
  margin: 0 0 24px 0;
  text-align: center;
}

/* ─── Modal Close in Corner ─── */
.modal-close-corner {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 10;
}

.modal-close-corner:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

.assign-modal .modal-body .modal-title {
  margin: 0 0 24px 0;
  text-align: center;
}

/* ─── Message Detail (Inline) ─── */
.message-detail {
  max-width: 800px;
  margin: 0 auto;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 20px;
}

.btn-back:hover {
  background: var(--bg-glass-hover);
  border-color: var(--blue);
  color: var(--blue);
}

.md-info {
  margin-bottom: 20px;
}

.md-from-line {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.md-time {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'JetBrains Mono', monospace;
}

.md-channel {
  color: var(--text-secondary);
  font-weight: normal;
}

.md-sep {
  color: var(--text-tertiary);
  margin: 0 6px;
}

.md-subject {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.md-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.md-thread {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.md-thread-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.md-thread-reply {
  padding: 12px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.md-reply-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.md-reply-meta strong {
  color: var(--text-primary);
  font-weight: 600;
}

.md-reply-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
}

/* ─── Message Detail Modal ─── */
.message-detail-modal {
  max-width: 600px;
  max-height: 85vh;
}

.message-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.md-source {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  background: var(--bg-layer-1);
}

.md-source.is-slack { background: rgba(230, 126, 185, 0.1); }
.md-source.is-gmail { background: rgba(79, 142, 255, 0.1); }
.md-source.is-support { background: rgba(165, 243, 252, 0.1); }

.md-meta {
  flex: 1;
  min-width: 0;
}

.md-from {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.md-channel {
  font-size: 12px;
  color: var(--text-tertiary);
}

.md-sep {
  margin: 0 6px;
}

.md-subject {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  line-height: 1.3;
}

.md-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.md-body a {
  color: var(--blue);
  text-decoration: underline;
}

.md-thread {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.md-thread-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.md-thread-reply {
  padding: 12px;
  background: var(--bg-layer-1);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.md-reply-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.md-reply-meta strong {
  color: var(--text-primary);
  font-weight: 600;
}

.md-reply-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.message-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-decoration: none;
}

.btn-action:hover {
  background: var(--bg-glass-hover);
  border-color: var(--blue);
  color: var(--blue);
}

.btn-action.btn-primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  text-decoration: none;
}

.btn-action.btn-primary:hover {
  background: var(--blue-bright);
  border-color: var(--blue-bright);
  color: white;
}

.btn-dropdown {
  position: relative;
  display: inline-flex;
}

.btn-dropdown-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 4px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 1000;
  min-width: 140px;
  padding: 4px;
}

.btn-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-dropdown-menu button:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.btn-dropdown-menu a {
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-dropdown-menu a:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

.dropdown-item {
  font-family: inherit;
}

/* Reply Box */
.reply-box {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.reply-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reply-to-line {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.reply-to-line strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.reply-textarea {
  width: 100%;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
}

.reply-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.reply-textarea::placeholder {
  color: var(--text-tertiary);
}

.reply-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-send {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-send:hover:not(:disabled) {
  background: var(--blue-bright);
  border-color: var(--blue-bright);
}

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.reply-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.2);
  border-radius: var(--radius-sm);
  color: #ff3b30;
  font-size: 12px;
}

/* Quick Actions */
.quick-actions-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.quick-actions-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.quick-action-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--blue);
  color: var(--blue);
}

.quick-action-btn svg {
  flex-shrink: 0;
}

.product-not-found-warning {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

[data-theme="light"] .product-not-found-warning {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
}

.warning-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.warning-content {
  flex: 1;
}

.warning-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
  margin-bottom: 6px;
  letter-spacing: -0.1px;
}

[data-theme="light"] .warning-title {
  color: #D97706;
}

.warning-text {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.warning-text ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.warning-text li {
  margin-bottom: 3px;
  color: var(--text-secondary);
}

/* No actions available state */
.no-actions-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  margin-top: 20px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  text-align: center;
}

.no-actions-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.no-actions-text {
  margin-bottom: 16px;
}

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

.no-actions-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
}

.btn-playbook {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-layer-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  cursor: not-allowed;
  transition: all 0.15s;
}

.btn-playbook svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Light mode adjustments */
[data-theme="light"] .no-actions-state {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .btn-playbook {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.4);
}

.md-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

/* ─── Light Mode Bold Text Fix ─── */
[data-theme="light"] .task.bold .t-name {
  color: #D97706;
}

[data-theme="light"] .t-star.on {
  color: #D97706;
}

/* ─── Tasks View ─── */
.filters-bar {
  padding: 16px 20px;
}

.filters-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  width: 100%;
}

.filter-group {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select,
.filter-search {
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  min-width: 140px;
  max-width: 200px;
}

.filter-select:focus,
.filter-search:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(79, 142, 255, 0.1);
}

.search-group {
  flex: 0 1 auto;
  min-width: 200px;
  max-width: 300px;
}

.filter-search {
  width: 100%;
  max-width: 300px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 0;
  padding: 0;
  height: 34px;
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--blue);
  margin: 0;
  flex-shrink: 0;
}

/* Tabs */
.tasks-tabs {
  display: flex;
  gap: 4px;
  padding: 16px 20px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.tasks-tab {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tasks-tab:hover {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tasks-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--bg-layer-1);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.tasks-tab.active .tab-count {
  background: rgba(79, 142, 255, 0.15);
  color: var(--blue);
}

/* Tasks Content */
.tasks-content {
  padding: 12px;
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.task-row > div {
  flex: 1;
}

.task-checkbox {
  margin-top: 14px;
  cursor: pointer;
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 24px;
}

.empty-state .btn-primary {
  display: inline-block;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
  background: var(--bg-glass-strong);
  border: 1px solid var(--blue);
  box-shadow: 0 4px 12px rgba(79, 142, 255, 0.2);
}

.bulk-actions-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
}

.bulk-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}

.bulk-buttons {
  display: flex;
  gap: 8px;
  flex: 1;
}

.bulk-divider {
  color: var(--border-subtle);
  margin: 0 4px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ─── Single Column Content ─── */
.content-single {
  display: block !important;
  grid-template-columns: none !important;
  max-width: 1400px;
}

/* ─── Delete Button ─── */
.t-delete {
  opacity: 0.5;
  transition: all 0.2s;
}

.t-delete:hover {
  opacity: 1;
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.t-delete svg {
  width: 14px;
  height: 14px;
}

/* ─── Quick Add Task ─── */
.quick-add-task {
  margin-bottom: 12px;
}

.quick-add-form {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.quick-add-form:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 142, 255, 0.1);
}

.quick-add-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.quick-add-input::placeholder {
  color: var(--text-tertiary);
}

.quick-add-select {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  outline: none;
}

.quick-add-select:focus {
  border-color: var(--blue);
}

.quick-add-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.quick-add-btn:hover:not(:disabled) {
  background: var(--blue-bright);
  transform: scale(1.05);
}

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

.quick-add-btn svg {
  width: 14px;
  height: 14px;
}

/* ===== Task Creation Modal ===== */
.create-task-modal .form-field {
  margin-bottom: 18px;
}

.create-task-modal .form-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.create-task-modal .select-field,
.create-task-modal input[type="text"],
.create-task-modal textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  box-sizing: border-box;
}

.create-task-modal .select-field:focus,
.create-task-modal input[type="text"]:focus,
.create-task-modal textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--bg-hover);
}

.create-task-modal .select-field:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.create-task-modal .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-start;
}

.create-task-modal .btn-primary,
.create-task-modal .btn-secondary {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.create-task-modal .btn-primary {
  background: var(--blue);
  color: white;
}

.create-task-modal .btn-primary:hover:not(:disabled) {
  background: var(--blue-bright);
}

.create-task-modal .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.create-task-modal .btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.create-task-modal .btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

.ai-loading .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.ai-reasoning {
  padding: 14px 16px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 8px;
  margin-bottom: 20px;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--gold);
  margin-bottom: 4px;
}

.char-count {
  text-align: right;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.modal-error {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: var(--red);
  font-size: 13px;
  margin-top: 16px;
}

/* ===== Created Tasks in Message Detail ===== */
.created-tasks-section {
  margin: 24px 0;
  padding: 16px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 8px;
}

.created-tasks-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.created-task-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  margin-bottom: 8px;
}

.created-task-link:last-child {
  margin-bottom: 0;
}

.created-task-link:hover {
  background: var(--bg-hover);
  border-color: var(--blue);
  color: var(--blue);
}

.created-task-link svg {
  color: var(--text-tertiary);
}

/* ========================================
   INBOX RULES
   ======================================== */

/* Rules Table */
.rules-table {
  overflow-x: auto;
}

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

.data-table thead {
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.rule-row {
  transition: opacity 0.2s;
}

.rule-row.inactive {
  opacity: 0.4;
}

.rule-row:hover {
  background: var(--bg-glass-hover);
}

/* Rule Type Badges */
.rule-type-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  letter-spacing: 0.3px;
}

.rule-type-badge.ignore-sender {
  background: rgba(248, 113, 113, 0.15);
  color: var(--red);
}

.rule-type-badge.ignore-channel {
  background: rgba(251, 191, 36, 0.15);
  color: var(--amber);
}

.rule-type-badge.ignore-keyword {
  background: rgba(79, 142, 255, 0.15);
  color: var(--blue);
}

.rule-type-badge.ignore-pattern {
  background: rgba(168, 85, 247, 0.15);
  color: #A855F7;
}

/* Rule Pattern */
.rule-pattern {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-layer-1);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-layer-1);
  border: 1.5px solid var(--border-subtle);
  border-radius: 22px;
  transition: all 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 2.5px;
  background-color: var(--text-tertiary);
  border-radius: 50%;
  transition: all 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--green);
  border-color: var(--green);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(18px);
  background-color: white;
}

/* Match Stats */
.match-count {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--text-primary);
}

.last-matched {
  font-size: 12px;
}

.last-matched .never {
  color: var(--text-tertiary);
  font-style: italic;
}

/* Rule Actions */
.rule-actions {
  text-align: right;
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-glass);
  color: var(--text-tertiary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-icon.btn-danger:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* Rule Modal */
.rule-modal {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 500px;
  width: 90%;
  border-radius: var(--radius);
  backdrop-filter: blur(0);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.rule-modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.rule-modal .modal-content {
  background: var(--bg-glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  padding: 24px;
}

.rule-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.rule-modal h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.btn-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-glass);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  transition: all 0.2s;
}

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

.rule-modal .form-group {
  margin-bottom: 20px;
}

.rule-modal label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rule-modal .select-field,
.rule-modal input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: all 0.2s;
  box-sizing: border-box;
}

.rule-modal .select-field:focus,
.rule-modal input[type="text"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 142, 255, 0.1);
  background: var(--bg-glass);
}

.rule-modal .select-field {
  cursor: pointer;
}

.field-help {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
  font-style: italic;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-label span {
  font-size: 13px;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.error-message {
  background: var(--red-soft);
  color: var(--red);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 16px;
}

/* ========================================
   PLAYBOOK MANAGEMENT UI
   ======================================== */

.playbook-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.playbook-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s ease;
}

.playbook-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--blue-soft);
  transform: translateY(-1px);
}

.playbook-card-header {
  margin-bottom: 16px;
}

.playbook-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.playbook-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.playbook-card-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.playbook-card:hover .playbook-card-actions {
  opacity: 1;
}

.playbook-card-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}

.playbook-institution {
  font-weight: 500;
}

.playbook-category {
  padding: 2px 8px;
  background: var(--bg-layer-1);
  border-radius: 4px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.playbook-usage {
  color: var(--text-tertiary);
}

.playbook-updated {
  color: var(--text-tertiary);
}

.playbook-card-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.playbook-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.playbook-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

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

.trigger-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.trigger-tag .trigger-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  background: transparent;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.trigger-tag .trigger-remove:hover {
  opacity: 1;
}

.reply-templates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reply-template {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-layer-1);
  border-radius: var(--radius-sm);
}

.reply-template-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 90px;
  flex-shrink: 0;
}

.reply-template-text {
  font-size: 13px;
  color: var(--text-primary);
  font-style: italic;
}

.quick-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-layer-1);
  border-radius: var(--radius-sm);
}

.quick-action-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 150px;
  flex-shrink: 0;
}

.quick-action-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  background: var(--bg-void);
  padding: 4px 8px;
  border-radius: 4px;
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
}

/* Institution Section */
.institution-section {
  margin-bottom: 32px;
}

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

.institution-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.institution-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.entry-count {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--blue);
  margin-bottom: 4px;
}

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

/* Modal Form Fields */
.form-group {
  margin-bottom: 20px;
}

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

.tag-input-container {
  width: 100%;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.reply-template-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reply-template-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reply-template-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.quick-actions-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-action-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quick-action-row input[type="text"] {
  margin-bottom: 0;
}

/* Page Header for Playbooks */
.page-header-left h1.page-title {
  margin: 0 0 4px 0;
}

.page-header-left .page-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  margin: 0;
}

/* Override Page Header for Playbooks */
.page-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.page-header-left {
  flex: 1;
}

.page-header-left h1.page-title {
  margin: 0 0 8px 0 !important;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header-left .page-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  margin: 0 !important;
}

.page-header-right {
  flex-shrink: 0;
  margin-left: 24px;
}

/* Institution Grid for Playbook Selection */
.institution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.institution-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.institution-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--blue-soft);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.institution-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.institution-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.institution-card-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.institution-card-count {
  font-weight: 500;
}

.institution-card-uses {
  color: var(--text-tertiary);
}

/* Playbook Form */
.playbook-form {
  max-width: 900px;
}

.form-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 32px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

/* AI Findings Section */
.ai-findings-section {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.ai-findings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-findings-header svg {
  color: var(--blue);
}

.ai-findings-content {
  font-size: 14px;
  color: var(--text-primary);
}

.product-name {
  font-size: 15px;
  margin-bottom: 8px;
}

.product-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.product-variants {
  margin-top: 12px;
}

.variants-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.variant-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-layer-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}

.variant-name {
  flex: 1;
  font-weight: 500;
}

.variant-price {
  font-weight: 600;
  color: var(--text-primary);
}

.variant-stock {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.variant-stock.in-stock,
.variant-stock.instock {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.variant-stock.low-stock,
.variant-stock.lowstock {
  background: rgba(251, 191, 36, 0.15);
  color: var(--yellow);
}

.variant-stock.out-of-stock,
.variant-stock.outofstock {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.product-price-stock {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.product-price-stock .price {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.product-price-stock .stock {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.product-price-stock .stock.in-stock,
.product-price-stock .stock.instock {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.product-price-stock .stock.low-stock,
.product-price-stock .stock.lowstock {
  background: rgba(251, 191, 36, 0.15);
  color: var(--yellow);
}

.product-price-stock .stock.out-of-stock,
.product-price-stock .stock.outofstock {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

/* Suggested Reply Section */
.suggested-reply-section {
  margin-bottom: 16px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(147, 51, 234, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
}

.suggested-reply-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.suggested-reply-header svg {
  color: var(--blue);
}

.suggested-reply-text {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 10px;
  padding: 8px;
  background: var(--bg-layer-1);
  border-radius: var(--radius-sm);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.btn-use-draft {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-use-draft:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.btn-use-draft svg {
  width: 12px;
  height: 12px;
}

/* ============================================
   Phantom AI
   ============================================ */

/* Bottom Bar */
.phantom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 60px;
  background: var(--bg-glass-strong);
  border-top: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 9px 24px;
  z-index: 9999;
  transition: all 0.3s ease;
}

/* Shrunk bar when side panel is open */
.phantom-bar-shrunk {
  left: auto;
  right: 24px;
  width: 520px;
  border-radius: var(--radius) var(--radius) 0 0;
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
}

.ph-glyph {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ph-glyph svg {
  width: 20px;
  height: 20px;
  color: var(--blue);
}

.ph-input {
  flex: 1;
  min-height: 42px;
  max-height: 200px;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all 0.2s;
  cursor: text;
  resize: none;
  overflow-y: auto;
}

.ph-input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--bg-glass-hover);
}

.ph-input::placeholder {
  color: var(--text-tertiary);
}

.ph-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ph-view-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ph-view-toggle:hover {
  background: var(--bg-glass-hover);
  border-color: var(--blue);
  color: var(--blue);
}

.ph-kbd {
  padding: 4px 8px;
  background: var(--bg-glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  flex-shrink: 0;
}

.ph-send {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  border: none;
  border-radius: var(--radius);
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ph-send:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.ph-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ph-send svg {
  width: 18px;
  height: 18px;
}

/* Conversation - Side Panel */
.ph-conversation-side {
  position: fixed;
  top: 40px;
  bottom: 230px;
  right: 24px;
  width: 520px;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  z-index: 9998;
}

/* Conversation - Full Screen */
.ph-conversation-full {
  position: fixed;
  bottom: 230px;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  z-index: 9998;
}

/* Header */
.ph-conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.ph-conv-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ph-conv-title .ph-btn-icon {
  margin-right: 4px;
}

.ph-conv-title svg {
  color: var(--blue);
}

.ph-conv-title h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.ph-conv-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ph-btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Messages */
.ph-conv-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ph-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.ph-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ph-msg-user .ph-msg-avatar {
  background: var(--bg-glass);
  border: 1px solid var(--glass-border);
}

.ph-msg-assistant .ph-msg-avatar {
  background: rgba(79, 142, 255, 0.1);
  border: 1px solid rgba(79, 142, 255, 0.3);
}

.ph-msg-user .ph-msg-avatar svg {
  color: var(--text-primary);
}

.ph-msg-assistant .ph-msg-avatar svg {
  color: var(--blue);
}

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

.ph-msg-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.ph-msg-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  word-wrap: break-word;
}

.ph-msg-text strong {
  font-weight: 600;
  color: var(--text-primary);
}

.ph-msg-text em {
  font-style: italic;
  color: var(--text-secondary);
}

.ph-link {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.ph-link:hover {
  border-bottom-color: var(--blue);
  color: var(--blue-bright);
}

/* Loading */
.ph-loading {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.ph-loading span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: ph-bounce 1.4s infinite ease-in-out both;
}

.ph-loading span:nth-child(1) {
  animation-delay: -0.32s;
}

.ph-loading span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes ph-bounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Conversations Panel */
.ph-conversations-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.ph-conversations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.ph-conversations-header h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.ph-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.ph-search-box svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.ph-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  padding: 4px 0;
}

.ph-search-input::placeholder {
  color: var(--text-tertiary);
}

.ph-conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.ph-conv-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.ph-conv-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--blue);
}

.ph-conv-item.active {
  background: rgba(79, 142, 255, 0.1);
  border-color: var(--blue);
}

.ph-conv-item.selected {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--blue);
}

.ph-conv-item.starred {
  border-color: var(--gold);
  background: rgba(255, 193, 7, 0.05);
}

.ph-conv-item.starred.active {
  background: rgba(255, 193, 7, 0.12);
  border-color: var(--gold);
}

.ph-conv-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ph-star-btn {
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ph-star-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--gold);
}

.ph-star-btn svg[fill="currentColor"] {
  color: var(--gold);
}

.ph-conv-item.starred .ph-star-btn {
  color: var(--gold);
}

.ph-conv-item-title-wrapper {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.ph-conv-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-rename-input {
  width: 100%;
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--blue);
  border-radius: 4px;
  outline: none;
}

.ph-rename-btn {
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
}

.ph-conv-item:hover .ph-rename-btn {
  opacity: 1;
}

.ph-rename-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--blue);
}

.ph-delete-btn {
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
}

.ph-conv-item:hover .ph-delete-btn {
  opacity: 1;
}

.ph-delete-btn:hover {
  background: rgba(255, 0, 0, 0.1);
  color: var(--red);
}

.ph-conv-item-preview {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 24px;
  cursor: pointer;
  line-height: 1.4;
}

.ph-conv-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
  cursor: pointer;
  padding-left: 24px;
}

.ph-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.ph-empty-state p {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
}

/* Notifications */

/* ===================================
   Daily Briefing Styles
   =================================== */

.briefing-container {
  position: relative;
}

.briefing-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.briefing-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--blue);
  color: var(--text-primary);
}

.briefing-btn.has-updates {
  border-color: var(--blue);
  color: var(--blue);
}

.briefing-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--blue);
  border-radius: 50%;
}

.briefing-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 420px;
  height: 600px;
  background: var(--bg-deep);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.briefing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

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

.briefing-title svg {
  color: var(--blue);
}

.briefing-title h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.briefing-close {
  padding: 6px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.briefing-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.briefing-stats {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(79, 142, 255, 0.05);
  flex-shrink: 0;
}

.brief-stat {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--blue);
}

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

.briefing-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty-briefing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.empty-briefing svg {
  margin-bottom: 12px;
  color: var(--text-tertiary);
}

.empty-briefing p {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
}

.brief-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.brief-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brief-msg-user .brief-msg-avatar {
  background: rgba(79, 142, 255, 0.2);
  color: var(--blue);
}

.brief-msg-assistant .brief-msg-avatar {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

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

.brief-msg-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

.brief-msg-text strong {
  font-weight: 600;
  color: var(--text-primary);
}

.brief-link {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s;
}

.brief-link:hover {
  border-bottom-color: var(--blue);
}

.brief-loading {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.brief-loading span {
  width: 6px;
  height: 6px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}

.brief-loading span:nth-child(2) {
  animation-delay: 0.2s;
}

.brief-loading span:nth-child(3) {
  animation-delay: 0.4s;
}

.briefing-input {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.briefing-input textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  transition: all 0.2s;
  resize: none;
}

.briefing-input textarea:focus {
  outline: none;
  border-color: var(--blue);
  background: rgba(255, 255, 255, 0.08);
}

.briefing-input textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.brief-send {
  padding: 10px 12px;
  background: var(--blue);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brief-send:hover:not(:disabled) {
  background: #5a8fff;
  transform: translateY(-1px);
}

.brief-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Daily Briefing Navigation */
.briefing-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn {
  padding: 6px;
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--blue);
  color: var(--blue);
}

.nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.today-btn {
  padding: 6px 10px;
  background: var(--blue);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.today-btn:hover {
  background: #5a8fff;
  transform: translateY(-1px);
}

/* ===================================================================
   System Status
   =================================================================== */

/* Status pill states */
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.status-pill:hover {
  transform: translateY(-1px);
}

.status-pill.status-ok {
  background: rgba(52, 211, 153, 0.1);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-pill.status-degraded {
  background: rgba(251, 191, 36, 0.1);
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.status-pill.status-failed {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Status icon */
.status-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-icon.ok { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, 0.3); }
.status-icon.degraded { background: var(--amber); box-shadow: 0 0 8px rgba(251, 191, 36, 0.3); }
.status-icon.failed { background: var(--red); box-shadow: 0 0 8px rgba(248, 113, 113, 0.3); }

/* Status badge */
.status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.ok {
  background: rgba(52, 211, 153, 0.1);
  color: var(--green);
}

.status-badge.degraded {
  background: rgba(251, 191, 36, 0.1);
  color: var(--amber);
}

.status-badge.failed {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
}

/* Status grid */
.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 1400px) {
  .status-grid {
    grid-template-columns: 1fr;
  }
}

/* Status card */
.status-card {
  border-left: 3px solid transparent;
  min-height: 200px;
}

.status-card.status-ok {
  border-left-color: var(--green);
}

.status-card.status-degraded {
  border-left-color: var(--amber);
}

.status-card.status-failed {
  border-left-color: var(--red);
}

/* Status details */
.status-details {
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-detail {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

.status-detail strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* Status error */
.status-error {
  padding: 12px 12px 12px 16px;
  background: rgba(248, 113, 113, 0.05);
  border-left: 2px solid var(--red);
  font-size: 12px;
  color: var(--red);
  margin: 12px 12px 0 12px;
  border-radius: 4px;
}

/* Status footer */
.status-footer {
  margin-top: 12px;
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Page header */
.page-header {
  margin-bottom: 32px;
}

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

.page-header .page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {
  /* ===== GLOBAL LAYOUT ===== */
  
  /* Hide sidebar on mobile */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  /* Adjust main content */
  .main {
    margin-left: 0;
    width: 100%;
  }
  
  .content-wrapper {
    padding: 16px;
  }
  
  /* Topbar adjustments */
  .topbar {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .greeting {
    font-size: 16px;
  }
  
  .greeting-sub {
    font-size: 11px;
  }
  
  .top-actions {
    gap: 8px;
  }
  
  /* ===== PHANTOM CHAT (COPILOT) ON MOBILE ===== */

  /* Phantom bar full-width on mobile */
  .phantom-bar {
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100; /* Below briefing */
  }

  /* Phantom conversation full-screen on mobile */
  .ph-conversation-side,
  .ph-conversation-full {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    /* Let inline style handle bottom (barHeight) */
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 10000;
  }

  /* Only apply flex when visible */
  .ph-conversation-side[style*="display: block"],
  .ph-conversation-full[style*="display: block"] {
    display: flex !important;
    flex-direction: column !important;
  }

  .ph-conv-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    max-height: none !important;
  }

  .ph-conv-header {
    flex-shrink: 0;
  }
  
  /* ===== STAGE VIEW ===== */
  
  .content {
    display: block !important;
    gap: 0;
  }
  
  .stage-main {
    width: 100% !important;
    margin-bottom: 20px;
  }
  
  .stage-sidebar {
    width: 100% !important;
  }
  
  .card {
    margin-bottom: 16px;
  }
  
  .card-h {
    font-size: 14px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .activity-item {
    padding: 12px;
  }
  
  /* ===== TASKS VIEW ===== */
  
  .tasks-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .tasks-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tasks-tab {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  .tasks-controls {
    flex-direction: column;
    gap: 8px;
  }
  
  .filters {
    flex-direction: column;
    gap: 8px;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .select-field,
  .search-field {
    width: 100%;
  }
  
  .bulk-actions {
    flex-wrap: wrap;
  }
  
  .btn-secondary {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  /* Task items */
  .task-item {
    padding: 12px;
  }
  
  .task-content {
    min-width: 0;
  }
  
  .task-name {
    font-size: 14px;
  }
  
  .task-meta {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .task-actions {
    position: static;
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
  }
  
  .t-btn {
    position: static;
    opacity: 1;
  }
  
  /* ===== INBOX VIEW ===== */
  
  .inbox-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .inbox-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .inbox-tab {
    font-size: 13px;
    padding: 8px 12px;
    white-space: nowrap;
  }
  
  .inbox-filters {
    flex-direction: column;
    gap: 8px;
  }
  
  .inbox-filter {
    width: 100%;
  }
  
  /* Message detail in modal on mobile */
  .inbox-detail-panel {
    padding: 12px;
  }
  
  .message-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .message-actions {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .msg-action {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  /* ===== FINANCIALS VIEW ===== */
  
  .goals-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  
  .goal-card {
    min-height: auto;
  }
  
  .goal-progress-bar {
    height: 6px;
  }
  
  .revenue-grid {
    grid-template-columns: 1fr;
  }
  
  .gp-month-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .gp-month-card {
    padding: 12px;
  }
  
  /* ===== SETTINGS VIEW ===== */
  
  .settings-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .institution-card {
    padding: 16px;
  }
  
  .institution-links {
    flex-direction: column;
    gap: 8px;
  }
  
  /* ===== MODALS ===== */
  
  .modal-overlay {
    padding: 0;
  }
  
  .modal-content,
  .rule-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    position: fixed;
    top: 0;
    left: 0;
    transform: none !important;
  }
  
  .modal-header {
    padding: 16px;
    position: sticky;
    top: 0;
    background: var(--bg-deep);
    z-index: 10;
  }
  
  .modal-body {
    padding: 16px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
  }
  
  .modal-actions {
    padding: 16px;
    position: sticky;
    bottom: 0;
    background: var(--bg-deep);
    border-top: 1px solid var(--border-subtle);
  }
  
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* ===== TABLES ===== */
  
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .data-table table {
    min-width: 600px;
  }
  
  /* ===== BUTTONS ===== */
  
  .btn-primary,
  .btn-secondary,
  .card-btn {
    min-height: 44px; /* Touch-friendly */
    padding: 10px 16px;
  }
  
  /* ===== DAILY BRIEFING ===== */

  .briefing-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    z-index: 10002; /* Above Phantom bar (10001) */
    display: flex;
    flex-direction: column;
  }

  .briefing-header {
    flex-shrink: 0;
  }

  .briefing-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .briefing-input {
    flex-shrink: 0;
    background: var(--bg-deep);
  }
  
  /* ===== STATUS PAGE ===== */
  
  .status-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .status-card {
    min-height: auto;
  }
  
  /* ===== HIDE ON MOBILE ===== */
  
  .hide-mobile {
    display: none !important;
  }
  
  /* ===== RESPONSIVE UTILITIES ===== */
  
  .mobile-full-width {
    width: 100% !important;
  }
  
  .mobile-stack {
    flex-direction: column !important;
  }
}

/* Tablet breakpoint */
@media (max-width: 1024px) and (min-width: 769px) {
  .sidebar {
    width: 200px;
  }
  
  .main {
    margin-left: 200px;
  }
  
  .content {
    padding: 24px;
  }
  
  .goals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.mobile-menu-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--blue);
  color: var(--blue);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
  
  /* Sidebar overlay */
  .sidebar::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: -1; /* Behind sidebar content */
  }

  .sidebar.mobile-open::before {
    opacity: 1;
    pointer-events: all;
  }

  .sidebar.mobile-open {
    z-index: 999;
  }

  /* Ensure sidebar content is above overlay */
  .sidebar-brand,
  .sidebar-nav,
  .sidebar-footer {
    position: relative;
    z-index: 1;
  }
}

/* Additional mobile form fixes */
@media (max-width: 768px) {
  /* Quick-add form */
  .quick-add-form {
    flex-wrap: wrap;
    padding: 12px;
  }
  
  .quick-add-input {
    min-width: 0;
    flex: 1 1 100%;
  }
  
  .quick-add-select {
    flex: 1 1 calc(50% - 4px);
  }
  
  .quick-add-btn {
    flex: 0 0 auto;
  }
  
  /* Disable drag handle on mobile */
  .drag-handle {
    opacity: 0.3;
    cursor: default;
  }
  
  /* Form inputs */
  .form-field,
  .select-field {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px;
  }
  
  /* Text areas */
  textarea.form-field {
    min-height: 100px;
  }
  
  /* Card actions */
  .card-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .card-btn {
    flex: 1 1 auto;
    min-width: max-content;
  }
  
  /* Briefing input */
  .briefing-input textarea {
    font-size: 16px;
  }
  
  /* Toast notifications */
  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
  
  /* Loading states */
  .loading-overlay {
    padding: 20px;
  }
  
  /* Empty states */
  .empty-state {
    padding: 40px 20px;
  }
  
  .empty-icon {
    width: 60px;
    height: 60px;
  }
}

/* Prevent zoom on input focus (iOS) */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Topbar mobile adjustments */
@media (max-width: 768px) {
  /* Briefing button */
  .briefing-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .briefing-btn svg {
    width: 16px;
    height: 16px;
  }
  
  .briefing-btn span:not(.briefing-dot) {
    display: none; /* Hide "Today" text on very small screens */
  }
  
  /* Status pill */
  .status-pill {
    padding: 6px 10px;
    font-size: 11px;
  }
  
  .live-dot {
    width: 6px;
    height: 6px;
  }
}

/* Small mobile (iPhone SE, etc.) */
@media (max-width: 375px) {
  .greeting {
    font-size: 14px;
  }
  
  .greeting-sub {
    font-size: 10px;
  }
  
  .topbar {
    padding: 10px 12px;
  }
  
  .content-wrapper {
    padding: 12px;
  }
  
  .card {
    padding: 12px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Final mobile polish */
@media (max-width: 768px) {
  /* Prevent horizontal scroll */
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .main,
  .content-wrapper {
    overflow-x: hidden;
  }
  
  /* Quick actions in inbox */
  .quick-actions-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
  
  .quick-action-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Playbook triggers */
  .trigger-list {
    flex-wrap: wrap;
    gap: 6px;
  }
  
  .trigger-tag {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  /* AI draft buttons */
  .ai-drafts {
    flex-direction: column;
    gap: 8px;
  }
  
  .draft-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Tab overflow handling */
  .tasks-tabs,
  .inbox-tabs {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }
  
  .tasks-tabs::-webkit-scrollbar,
  .inbox-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  
  /* Progress indicators */
  .goal-progress {
    font-size: 12px;
  }
  
  .progress-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  /* Institution cards in settings */
  .institution-card {
    min-height: auto;
  }
  
  .institution-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  /* Rules page */
  .rules-list {
    gap: 12px;
  }
  
  .rule-item {
    padding: 12px;
  }
  
  .rule-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .rule-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  /* Gmail accounts page */
  .gmail-account-card {
    padding: 12px;
  }
  
  .gmail-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .gmail-actions .btn-secondary {
    width: 100%;
  }
  
  /* Task workflows */
  .workflow-section {
    padding: 12px;
  }
  
  .workflow-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  /* Stage dashboard specific */
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
  
  .stat-card {
    min-height: auto;
    padding: 16px;
  }
  
  /* Activity feed */
  .activity-feed {
    max-height: 400px;
  }
  
  .activity-item-meta {
    font-size: 11px;
  }
  
  /* Revenue entries */
  .revenue-entries {
    overflow-x: auto;
  }
  
  .revenue-table {
    min-width: 600px;
  }
}

/* Landscape mobile */
@media (max-width: 896px) and (max-height: 414px) and (orientation: landscape) {
  .topbar {
    padding: 8px 12px;
  }
  
  .greeting {
    font-size: 14px;
  }
  
  .greeting-sub {
    display: none;
  }
  
  .briefing-panel {
    max-height: 90vh;
  }
  
  .modal-content,
  .rule-modal {
    max-height: 90vh;
  }
}

/* INBOX MOBILE FIX */
@media (max-width: 768px) {
  /* Override inbox layout for mobile */
  .inbox-container {
    position: relative;
    display: block !important;
    height: auto !important;
    min-height: calc(100vh - 100px);
  }

  /* Message list - always full width on mobile */
  .inbox-list-panel {
    width: 100%;
    max-width: 100%;
    height: calc(100vh - 80px);
    overflow-y: auto !important;
  }

  /* Detail panel - hidden by default, slides in as overlay when message selected */
  .inbox-detail-panel {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 80px;
    width: 100%;
    padding: 16px;
    background: var(--bg-layer-0);
    z-index: 1000;
    overflow-y: auto;
  }

  /* Show detail panel when message is selected */
  .inbox-container:has(.inbox-list-panel.has-detail) .inbox-detail-panel {
    display: block;
  }
  
  .inbox-list-card {
    border-radius: var(--radius);
  }
  
  /* Back button for message detail */
  .message-back-btn {
    display: flex !important;
  }
  
  /* Inbox header responsive */
  .inbox-header {
    padding: 12px 16px;
  }
  
  .inbox-header h1 {
    font-size: 20px;
  }
}

/* Back button (hidden on desktop, shown on mobile) */
.message-back-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.message-back-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--blue);
}

.message-back-btn svg {
  width: 16px;
  height: 16px;
}

/* Topbar scroll behavior on mobile */
@media (max-width: 768px) {
  .topbar {
    transition: transform 0.3s ease;
    position: sticky;
    top: 0;
    z-index: 100;
  }
}

/* Mobile chat close buttons */
@media (max-width: 768px) {
  /* Make close buttons more prominent on mobile */
  .briefing-close,
  .ph-btn-icon {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Chat headers sticky on mobile */
  .briefing-header,
  .ph-conv-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border-subtle);
  }

  /* Phantom toggle button when chat is closed */
  .phantom-bar:not(.phantom-bar-shrunk) {
    left: 0;
    right: 0;
    width: 100%;
  }
}

/* Phantom chat overlay for mobile close */
@media (max-width: 768px) {
  .ph-conversation-side::before,
  .ph-conversation-full::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }
  
  /* Make close button larger and more visible on mobile */
  .ph-conv-header .ph-btn-icon[title="Close"] {
    min-width: 48px;
    min-height: 48px;
    background: var(--bg-glass);
    border-radius: var(--radius);
  }
  
  .ph-conv-header .ph-btn-icon[title="Close"]:hover {
    background: var(--red);
    color: white;
  }
}

/* Daily briefing mobile input fixes */
@media (max-width: 768px) {
  .briefing-input textarea {
    font-size: 16px !important; /* Prevent iOS zoom */
    min-height: 44px; /* Touch-friendly */
  }
  
  .brief-send {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* Ensure input area is clickable and visible */
  .briefing-input {
    position: relative;
    z-index: 10;
    background: var(--bg-deep);
  }
}

/* Hide Phantom bar when daily briefing is open on mobile */
@media (max-width: 768px) {
  body:has(.briefing-panel:not([style*="display: none"])) .phantom-bar {
    display: none !important;
  }
}
/*
 * Phantom Design System


 */
