/* ═══════════════════════════════════════════════════════════════
   Jurin — Linear × Raycast warm-neutral design
   ═══════════════════════════════════════════════════════════════ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

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

:root {
  /* ── Warm neutral palette (Linear × Raycast) ── */
  --bg:          #FFFFFF;
  --bg-subtle:   #FAFAFA;
  --bg-hover:    #F4F4F4;
  --bg-active:   #EFEFEF;
  --bg-active-t: rgba(28,46,114,0.06);

  /* Text hierarchy */
  --text-1:  #111111;
  --text-2:  #555555;
  --text-3:  #999999;
  --text-4:  #BBBBBB;

  /* Structure — felt, not seen */
  --line:    rgba(0,0,0,0.06);
  --line-2:  rgba(0,0,0,0.10);

  /* Brand — used sparingly */
  --brand:       #1C2E72;
  --brand-hover: #16255C;
  --brand-mid:   rgba(28,46,114,0.12);
  --brand-light: #EEF2FF;

  /* Status */
  --sage:       #16A34A;
  --sage-bg:    rgba(22,163,74,0.10);
  --rust:       #DC2626;
  --rust-bg:    rgba(220,38,38,0.10);
  --ochre:      #D97706;
  --ochre-bg:   rgba(217,119,6,0.10);
  --crimson:    #DC2626;
  --crimson-bg: rgba(220,38,38,0.10);
  --sub:        #134E4A;
  --sub-light:  #F0FDFA;
  --sub-hover:  #0D3D3A;

  --mute:       var(--text-3);
  --dim:        var(--text-4);
  --border:     var(--line-2);
  --text:       var(--text-1);

  /* Typography */
  --font-display: 'Pretendard Variable','Pretendard',-apple-system,sans-serif;
  --font-body:    'Pretendard Variable','Pretendard',-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  --font-mono:    'Geist Mono','SF Mono',Menlo,monospace;
  --font-serif:   Georgia,serif;

  /* Radius */
  --radius:    12px;
  --radius-sm:  8px;
  --radius-xs:  5px;

  /* Spacing (4px grid) */
  --space-1:  4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px;  --space-6: 24px; --space-8: 32px; --space-12: 48px;

  /* Motion */
  --ease: cubic-bezier(.2,.8,.2,1);
  --fast: 120ms;
  --med:  200ms;
  --slow: 400ms;

  /* Semantic (Madia compat) */
  --text-primary:   var(--text-1);
  --text-secondary: var(--text-2);
  --text-tertiary:  var(--text-3);
  --text-disabled:  var(--text-4);
  --bg-base:        var(--bg);
  --bg-surface:     var(--bg-subtle);
  --bg-overlay:     rgba(0,0,0,0.5);
}

/* ── Dark mode ── */
:root[data-theme="dark"] {
  --bg:          #0B0B0E;
  --bg-subtle:   #111114;
  --bg-hover:    #17171C;
  --bg-active:   #1E1E22;
  --bg-active-t: rgba(100,120,200,0.12);
  --text-1:      #F4EFE4;
  --text-2:      #C7C1B2;
  --text-3:      #8B8478;
  --text-4:      #6A645A;
  --line:        rgba(244,239,228,0.06);
  --line-2:      rgba(244,239,228,0.12);
  --brand-mid:   rgba(100,120,200,0.18);
  --brand-light: rgba(28,46,114,0.20);
  --sage:        #9CB39B;
  --sage-bg:     rgba(156,179,155,0.10);
  --rust:        #C77A5A;
  --rust-bg:     rgba(199,122,90,0.10);
  --ochre:       #D4A84B;
  --ochre-bg:    rgba(212,168,75,0.10);
  --crimson:     #B85C50;
  --crimson-bg:  rgba(184,92,80,0.10);
}

/* ═══ APP SHELL ═══ */
html, body {
  height: 100%; height: 100dvh;
  overflow: hidden;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-1);
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.app-shell {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-subtle);
  border-right: 1px solid var(--line-2);
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 0;
  transition: transform var(--med) var(--ease);
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.sidebar-logo {
  width: 28px; height: 28px;
  background: var(--brand);
  color: #fff;
  font-size: 14px; font-weight: 700;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.sidebar-wordmark {
  font-size: 15px; font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 4px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
  position: relative;
  white-space: nowrap;
  user-select: none;
}
.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-1);
}
.sidebar-item.active {
  background: var(--brand-soft, rgba(28,46,114,0.07));
  color: var(--brand);
}
.sidebar-item.active .sidebar-icon {
  color: var(--brand);
}
.sidebar-icon {
  flex-shrink: 0;
  color: var(--text-3);
  transition: color var(--fast) var(--ease);
}
.sidebar-item:hover .sidebar-icon {
  color: var(--text-2);
}

/* Footer */
.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--line);
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar-profile-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--fast), color var(--fast);
}
.sidebar-profile-btn:hover {
  background: var(--bg-hover);
  color: var(--rust);
}
.sidebar-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-profile-name {
  flex: 1;
  font-size: 13px;
}

/* Approval badge in sidebar */
.sidebar-item .approval-badge {
  margin-left: auto;
  background: var(--rust);
  color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

/* ═══ MAIN WRAPPER ═══ */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

main#mainContent {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ═══ MOBILE TOPBAR ═══ */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--line-2);
  background: var(--bg);
  flex-shrink: 0;
}
.mobile-menu-btn {
  background: none; border: none;
  padding: 6px; cursor: pointer;
  color: var(--text-2);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.mobile-topbar-title {
  flex: 1;
  font-size: 15px; font-weight: 600;
  color: var(--text-1);
}

/* ═══ MOBILE BOTTOM TAB BAR ═══ */
.mobile-tabbar {
  display: none;
  border-top: 1px solid var(--line-2);
  background: var(--bg);
  height: 56px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  flex-shrink: 0;
}
.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px; font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--fast);
  padding: 6px 0;
}
.mobile-tab.active {
  color: var(--brand);
}
.mobile-tab svg {
  stroke: currentColor;
}

/* ═══ SIDEBAR OVERLAY (mobile) ═══ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 149;
}
.sidebar-overlay.open { display: block; }

/* ═══ TAB SIDEBAR BACKDROP — z-index 51, BELOW tab sidebars (52) ═══
     Lives inside main#mainContent stacking context (z-index 2 at root).
     Session/cal/opp sidebars are also inside that context at z-52,
     so 52 > 51 → sidebars always render above the backdrop. ═══ */
.tab-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 51;
  transition: opacity 0.28s ease;
}
.tab-sidebar-backdrop.open { display: block; }

/* ═══ TABLET: Icon Rail ═══ */
@media (max-width: 1023px) and (min-width: 640px) {
  .sidebar {
    width: 56px;
    padding: 12px 0;
  }
  .sidebar-wordmark,
  .sidebar-group-label,
  .sidebar-item span,
  .sidebar-profile-name,
  .sidebar-item .approval-badge {
    display: none;
  }
  .sidebar-brand {
    justify-content: center;
    padding: 0 0 16px;
    margin-bottom: 8px;
  }
  .sidebar-nav {
    padding: 0 4px;
    gap: 4px;
  }
  .sidebar-group {
    gap: 2px;
  }
  .sidebar-item {
    justify-content: center;
    padding: 10px;
    border-radius: 8px;
  }
  .sidebar-footer {
    padding: 4px;
  }
  .sidebar-profile-btn {
    justify-content: center;
    padding: 10px;
  }
  .sidebar-avatar { width: 22px; height: 22px; }
  .sidebar-icon { width: 18px; height: 18px; }
}

/* ═══ MOBILE: Hidden sidebar + bottom bar ═══ */
@media (max-width: 639px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    width: 260px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.12);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-topbar {
    display: flex;
  }
  .mobile-tabbar {
    display: flex;
  }
}

/* Grain texture — dark mode only */
:root[data-theme="dark"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .04 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}
.app-shell, main#mainContent { position: relative; z-index: 2; }

.icon-btn {
  background: transparent; border: none;
  color: var(--text-3); cursor: pointer;
  padding: 8px; border-radius: var(--radius-xs);
  display: flex; align-items: center;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--text-1); background: var(--bg-hover); }

/* ═══ LAYOUT ═══ */
.tab {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  padding: 28px 32px 32px;
  flex-direction: column; gap: 20px;
}
#tab-chat     { padding: 0 !important; gap: 0; }
#tab-projects { padding: 0 !important; overflow: hidden; }
.tab.active { display: flex; flex-direction: column; }
.tab.active.graph-mode { overflow: hidden; }


.tab-header {
  display: flex; align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px; flex-shrink: 0;
}
.tab-header h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.03em; color: var(--text-1); line-height: 1.1;
}
.tab-header .eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--brand);
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 2px;
}

/* ═══ BUTTONS ═══ */
.btn-primary {
  padding: 9px 18px; min-height: 48px;
  background: var(--brand); color: white; border: none;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; letter-spacing: -0.01em;
  transition: background var(--fast) var(--ease);
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  padding: 9px 18px; min-height: 48px;
  background: transparent; color: var(--text-2);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer; font-family: inherit;
  transition: all var(--fast) var(--ease);
}
.btn-secondary:hover { border-color: var(--text-3); color: var(--text-1); }

.btn-danger {
  padding: 5px 12px; min-height: 36px;
  background: transparent; color: var(--crimson);
  border: 1px solid rgba(220,38,38,0.3); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: all var(--fast) var(--ease);
}
.btn-danger:hover { background: var(--crimson-bg); }

.btn-sm { padding: 5px 12px; min-height: 36px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-new { display: flex; align-items: center; gap: 4px; padding: 4px 10px; background: var(--brand); color: white; border: none; border-radius: var(--radius-xs); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; transition: opacity var(--fast); }
.btn-new:hover { opacity: 0.85; }

/* ═══ BADGES ═══ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
  font-family: var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.06em; border: 1px solid;
}
.badge.success { background: var(--sage-bg); color: var(--sage); border-color: rgba(22,163,74,0.2); }
.badge.failed,.badge.error { background: var(--rust-bg); color: var(--rust); border-color: rgba(220,38,38,0.2); }
.badge.running,.badge.pending { background: var(--ochre-bg); color: var(--ochre); border-color: rgba(217,119,6,0.2); }
.badge.enabled,.badge.active { background: var(--brand-light); color: var(--brand); border-color: var(--brand-mid); }
.badge.disabled { background: transparent; color: var(--text-4); border-color: var(--line-2); }

/* ═══ TODAY DASHBOARD ═══ */
.today-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.today-greeting {
  font-family: var(--font-body);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-1);
}
.today-greeting em {
  font-style: normal;
  color: var(--brand);
  font-weight: 700;
}
.today-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: right;
  line-height: 1.6;
}
.today-date strong { color: var(--text-1); font-weight: 500; }

.today-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}
.today-section { display: flex; flex-direction: column; gap: 14px; }
.today-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.today-section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--brand);
  border-radius: 50%;
}
.today-section-title .count {
  margin-left: auto;
  color: var(--text-4);
  font-weight: 400;
}

.today-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: padding var(--med) var(--ease);
}
.today-item:last-child { border-bottom: none; }
.today-item:hover { padding-left: 6px; }
.today-item-marker {
  width: 52px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  padding-top: 2px;
}
.today-item-marker.overdue { color: var(--crimson); }
.today-item-marker.urgent { color: var(--rust); }
.today-item-marker.soon { color: var(--ochre); }
.today-item-marker.ok { color: var(--sage); }
.today-item-marker.dim { color: var(--mute); }
.today-item-body { flex: 1; min-width: 0; }
.today-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.4;
}
.today-item-meta {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.today-brief {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  position: relative;
}
.today-brief::before {
  content: '"';
  position: absolute;
  top: 0;
  left: 12px;
  font-family: var(--font-body);
  font-size: 60px;
  color: var(--brand);
  opacity: .2;
  line-height: 1;
}
.today-brief-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.today-brief-body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  font-weight: 400;
  max-height: 160px;
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 70%, transparent);
  letter-spacing: -0.005em;
}
.today-brief-from { font-size: 13px; color: var(--text-3); margin-top: 10px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Focus Point Banner */
#todayFocusPoint { margin-bottom: 16px; }
.focus-inner {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--fast) var(--ease);
}
.focus-inner:hover { border-color: var(--brand-mid); }
.focus-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.focus-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.focus-proj {
  color: var(--text-3);
  font-size: 13px;
  margin-right: 6px;
}
.focus-dday {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.focus-dday.overdue { background: rgba(239,68,68,0.12); color: #ef4444; }
.focus-dday.urgent  { background: rgba(249,115,22,0.12); color: #f97316; }
.focus-dday.soon    { background: rgba(234,179,8,0.12);  color: #ca8a04; }
.focus-dday.normal  { background: rgba(34,197,94,0.1);   color: #16a34a; }

.today-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.today-quick button {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--fast) var(--ease);
  text-align: left;
}
.today-quick button:hover { border-color: var(--brand-mid); color: var(--brand); }
.today-quick button .key {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-4);
  margin-left: auto;
  border: 1px solid var(--line-2);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ═══ TODAY — MAIN LAYOUT ═══ */
.today-strip-wrap {
  margin-bottom: 20px;
}
.today-strip-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
#todayMilestoneStrip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
#todayMilestoneStrip::-webkit-scrollbar { display: none; }

/* Milestone chip */
.ms-chip {
  flex-shrink: 0;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  min-width: 150px;
  max-width: 220px;
  cursor: default;
}
.ms-chip-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}
.ms-chip-bar {
  width: 100%;
  height: 3px;
  background: var(--line-2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 5px;
}
.ms-chip-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}
.ms-chip-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Main grid */
.today-main {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
.today-sidebar {
  position: sticky;
  top: 0;
}


/* Task detail sheet */
.task-detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}
.task-detail-sheet.open { display: block; }
.task-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.task-detail-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-subtle);
  border-top: 1px solid var(--line-2);
  border-radius: 16px 16px 0 0;
  padding: 20px 20px 36px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.1);
  animation: slideUp var(--fast) var(--ease) both;
}
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.task-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.task-detail-ms-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-3);
}
.task-detail-close {
  background: transparent; border: none; color: var(--text-3);
  font-size: 16px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; line-height: 1; transition: color var(--fast);
}
.task-detail-close:hover { color: var(--text-1); }
.task-detail-title {
  font-size: 16px; font-weight: 600; color: var(--text-1);
  line-height: 1.4; margin: 0 0 14px;
}
.task-detail-why {
  font-size: 13px; color: var(--text-2); line-height: 1.6;
  background: var(--brand-light); padding: 8px 12px;
  border-radius: 0 6px 6px 0; margin-bottom: 12px;
}
.task-detail-why-label {
  display: inline-block; font-size: 13px;
  color: var(--brand); background: var(--brand-light);
  border-radius: 3px; padding: 1px 5px; margin-right: 8px;
  vertical-align: middle; letter-spacing: 0.05em;
}
.task-detail-ms-context {
  display: flex; flex-direction: column; gap: 4px; margin-top: 8px;
}
.task-detail-ctx-line {
  font-size: 13px; color: var(--text-4);
  padding: 3px 0; border-bottom: 1px solid var(--line);
}

/* Legacy today task styles (kept for other uses) */
.today-proj-group {
  margin-bottom: 12px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line-2);
}
.today-proj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-hover);
  border-bottom: 1px solid var(--line);
}
.today-proj-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.today-proj-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.today-proj-count {
  font-size: 13px;
  color: var(--mute);
  font-family: var(--font-mono);
}
.today-proj-chat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--mute);
  font-size: 13px;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.today-proj-chat:hover { border-color: var(--brand); color: var(--brand); }
.today-milestone-sub {
  padding: 8px 14px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--line);
}
.today-milestone-sub:first-of-type { border-top: none; }
.today-milestone-sub-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--mute);
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.today-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.today-task-item:last-child { border-bottom: none; }
.today-task-item input[type="checkbox"] {
  accent-color: var(--brand);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.today-task-title {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.4;
}
.today-task-title.done {
  text-decoration: line-through;
  color: var(--dim);
}

/* ═══ MILESTONE CARDS — SVG RING ═══ */
.milestone-card {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--med) var(--ease);
}
.milestone-card:hover { border-color: var(--line-2); }
.milestone-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.milestone-ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
}
.milestone-ring { display: block; }
.milestone-ring-arc {
  transition: stroke-dashoffset 0.7s var(--ease), stroke 0.4s var(--ease);
}
.milestone-ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-1);
  letter-spacing: -0.03em;
}
.milestone-ring-pct small {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
  margin-left: 1px;
}
.milestone-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}
.milestone-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.milestone-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.milestone-project {
  font-size: 13px;
  color: var(--text-3);
}
.milestone-sprint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.milestone-sprint-bar {
  flex: 1;
  height: 4px;
  background: var(--line-2);
  border-radius: 2px;
  overflow: hidden;
}
.milestone-sprint-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}
.milestone-sprint-label {
  font-size: 13px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.milestone-tasks {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.milestone-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-1);
}
.milestone-task-item:last-of-type { border-bottom: none; }
.milestone-task-item input[type="checkbox"] {
  accent-color: var(--brand);
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
.milestone-task-item span.done {
  text-decoration: line-through;
  color: var(--text-4);
}
.milestone-no-tasks {
  font-size: 13px;
  color: var(--text-4);
  padding: 6px 0;
  font-style: italic;
}
.milestone-add-task {
  background: transparent;
  border: 1px dashed var(--line-2);
  border-radius: 6px;
  color: var(--text-3);
  font-size: 13px;
  font-family: inherit;
  padding: 6px 10px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: border-color var(--fast), color var(--fast);
}
.milestone-add-task:hover { border-color: var(--brand-mid); color: var(--brand); }

/* ═══ CHAT LAYOUT ═══ */
.chat-layout { display: flex; flex: 1; min-height: 0; position: relative; overflow: hidden; }

.session-sidebar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 260px;
  background: var(--bg-subtle);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
  z-index: 52;
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0,0,0,.1);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.22s, visibility 0s;
}
.session-sidebar.collapsed {
  transform: translateX(-100%);
  box-shadow: none;
  pointer-events: none;
}

.session-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 10px 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.session-sidebar-title {
  font-size: 14px; font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.session-close-btn { display: none; }


.session-list { flex: 1; overflow-y: auto; padding: 6px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.session-list::-webkit-scrollbar { width: 4px; }
.session-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

.session-item {
  padding: 8px 40px 8px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer; margin-bottom: 1px;
  transition: background var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
  position: relative;
}
.session-item:hover { background: var(--bg-hover); }
.session-item.active { background: var(--bg-active-t); }

.session-item-name {
  font-size: 13px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.005em;
}
.session-item.active .session-item-name { color: var(--text-1); font-weight: 600; }
.session-item-time {
  font-size: 11px; color: var(--text-4);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.session-item-meta {
  font-size: 11px; color: var(--text-3);
  margin-top: 2px; display: flex; gap: 6px; align-items: center;
  font-family: var(--font-mono);
}
.session-item-cat {
  font-size: 11px; padding: 1px 6px; border-radius: 10px;
  background: transparent; border: 1px solid var(--line-2);
  color: var(--text-4); text-transform: uppercase; letter-spacing: 0.06em;
}
.session-item-pin { color: var(--brand); font-size: 11px; }

/* Hover action buttons */
.session-hover-actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; align-items: center; gap: 2px;
  opacity: 0; pointer-events: none;
  transition: opacity 140ms;
}
.session-item:hover .session-hover-actions,
.session-item.active .session-hover-actions { opacity: 1; pointer-events: auto; }
.s-action-btn {
  width: 24px; height: 24px; border-radius: 5px;
  border: none; background: var(--bg-active); color: var(--text-3);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--fast), color var(--fast);
}
.s-action-btn:hover { background: var(--line-2); color: var(--text-1); }
.s-action-btn.pinned { color: var(--brand); }
.s-action-btn.s-action-del:hover { background: var(--crimson-bg); color: var(--crimson); }

/* Mobile three-dot */
.s-mobile-more-btn {
  display: none; position: absolute; top: 50%; right: 8px;
  transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 6px;
  border: none; background: transparent; color: var(--text-3);
  cursor: pointer; align-items: center; justify-content: center;
}
.s-mobile-more-btn:active { background: var(--bg-hover); color: var(--text-1); }

/* Mobile context menu */
.session-mobile-menu {
  position: fixed; z-index: 9990;
  background: var(--bg-subtle); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 4px; min-width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.smm-item {
  display: block; width: 100%; padding: 10px 14px;
  border: none; background: transparent; color: var(--text-1);
  font-size: 14px; text-align: left; cursor: pointer; border-radius: 7px;
}
.smm-item:hover { background: var(--bg-hover); }
.smm-item.danger { color: var(--crimson); }
.smm-item.danger:hover { background: var(--crimson-bg); }

/* Sidebar footer — new session CTA */
.session-sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.session-new-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.session-new-btn:hover { background: var(--bg-hover); color: var(--text-1); border-color: var(--brand-mid); }

/* Trash section */
.session-trash-section { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 4px; }
.session-trash-toggle {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 7px 10px;
  background: transparent; border: none; color: var(--text-3);
  font-size: 13px; cursor: pointer; border-radius: 6px; text-align: left;
}
.session-trash-toggle:hover { background: var(--bg-hover); color: var(--text-2); }
.trash-chevron { margin-left: auto; transition: transform 0.15s; }
.session-trash-toggle[aria-expanded="true"] .trash-chevron { transform: rotate(180deg); }
.session-trash-item { position: relative; padding: 7px 10px; border-radius: 6px; cursor: default; }
.session-trash-item:hover { background: var(--bg-hover); }
.session-trash-name { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 48px; }
.session-trash-meta { font-size: 11px; color: var(--text-4); margin-top: 2px; }
.session-trash-actions { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: none; gap: 2px; }
.session-trash-item:hover .session-trash-actions { display: flex; }

/* Jurin modal overlay */
.jurin-modal-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 160ms var(--ease); }
.jurin-modal-overlay.open { opacity: 1; pointer-events: auto; }
.jurin-modal { background: var(--bg-subtle); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 24px; min-width: 300px; max-width: 420px; width: 90vw; box-shadow: 0 16px 48px rgba(0,0,0,0.12); display: flex; flex-direction: column; gap: 16px; transform: translateY(-8px); transition: transform 160ms var(--ease); }
.jurin-modal-overlay.open .jurin-modal { transform: translateY(0); }
.jurin-modal-msg { font-size: 14px; color: var(--text-1); line-height: 1.5; margin: 0; }
.jurin-modal-input { width: 100%; padding: 8px 12px; min-height: 56px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--bg); color: var(--text-1); font-family: inherit; font-size: 13px; outline: none; transition: border-color var(--fast); }
.jurin-modal-input:focus { border-color: var(--brand); }
.jurin-modal-input.hidden { display: none; }
.jurin-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.jurin-modal-cancel { padding: 7px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: transparent; color: var(--text-3); font-family: inherit; font-size: 13px; cursor: pointer; transition: background var(--fast), color var(--fast); }
.jurin-modal-cancel:hover { background: var(--bg-hover); color: var(--text-1); }
.jurin-modal-confirm { padding: 7px 16px; border-radius: var(--radius-sm); border: none; background: var(--brand); color: white; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity var(--fast); }
.jurin-modal-confirm:hover { opacity: .85; }
.jurin-modal-confirm.danger { background: var(--crimson); }

/* Chat main */
.chat-container {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  background: var(--bg); overflow: hidden;
}
.chat-header {
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0; background: var(--bg); height: 48px;
}
.chat-session-name {
  font-size: 14px; font-weight: 600; flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.015em; color: var(--text-1);
}
.chat-header-actions { display: flex; gap: 8px; align-items: center; }
.session-toggle { display: flex; align-items: center; justify-content: center; }

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 28px 32px;
  display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

/* Message rows */
.msg-row { display: flex; flex-direction: column; max-width: 100%; width: 100%; }
.msg-row.user { align-items: flex-end; }
.msg-row.assistant { align-items: stretch; }

/* Message bubbles — asymmetric Raycast style */
.msg-bubble {
  padding: 10px 16px;
  font-size: 14px; line-height: 1.45;
  word-break: break-word; overflow-wrap: anywhere;
  white-space: pre-wrap; letter-spacing: -0.005em;
}
.msg-row.user .msg-bubble {
  max-width: 68%;
  background: #3B55C8; color: white;
  border-radius: 14px 4px 14px 14px;
  font-weight: 500;
}
.msg-row.assistant .msg-bubble {
  width: 100%; background: transparent;
  border: none; color: var(--text-1);
  border-radius: 0;
}

/* Markdown in assistant bubbles */
.msg-row.assistant .msg-bubble { line-height: 1.45; white-space: normal; }
.msg-row.assistant .msg-bubble p { margin: 0; line-height: 1.45; }
.msg-row.assistant .msg-bubble p + p { margin-top: 4px; }
.msg-row.assistant .msg-bubble h1,.msg-row.assistant .msg-bubble h2,
.msg-row.assistant .msg-bubble h3,.msg-row.assistant .msg-bubble h4 {
  font-weight: 700; letter-spacing: -0.015em; margin: 12px 0 4px; line-height: 1.2; color: var(--text-1);
}
.msg-row.assistant .msg-bubble h1 { font-size: 20px; }
.msg-row.assistant .msg-bubble h2 { font-size: 17px; }
.msg-row.assistant .msg-bubble h3 { font-size: 15px; color: var(--brand); }
.msg-row.assistant .msg-bubble h4 { font-size: 13px; color: var(--brand); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-mono); font-weight: 500; }
.msg-row.assistant .msg-bubble strong { font-weight: 600; color: var(--text-1); }
.msg-row.assistant .msg-bubble em { font-style: italic; color: var(--text-2); }
.msg-row.assistant .msg-bubble del { color: var(--text-3); }
.msg-row.assistant .msg-bubble ul,.msg-row.assistant .msg-bubble ol { margin: 4px 0; padding-left: 22px; }
.msg-row.assistant .msg-bubble li { margin: 3px 0; line-height: 1.45; }
.msg-row.assistant .msg-bubble li p { margin: 0; }
.msg-row.assistant .msg-bubble li::marker { color: var(--brand); }
.msg-row.assistant .msg-bubble code {
  background: var(--bg-hover); padding: 2px 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 13px; color: var(--brand);
  border: 1px solid var(--line-2);
}
.msg-row.assistant .msg-bubble pre {
  background: var(--bg-hover); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin: 10px 0; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.55;
}
.msg-row.assistant .msg-bubble pre code { background: transparent; border: none; padding: 0; color: var(--text-1); }
.msg-row.assistant .msg-bubble table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.msg-row.assistant .msg-bubble th,.msg-row.assistant .msg-bubble td { border: 1px solid var(--line-2); padding: 6px 10px; text-align: left; }
.msg-row.assistant .msg-bubble th { background: var(--bg-hover); font-weight: 600; color: var(--text-1); }
.msg-row.assistant .msg-bubble td { color: var(--text-2); }
.msg-row.assistant .msg-bubble hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.msg-row.assistant .msg-bubble blockquote { border-left: 3px solid var(--brand-mid); padding: 6px 12px; margin: 8px 0; color: var(--text-2); }
.msg-row.assistant .msg-bubble a { color: var(--brand); text-decoration: underline; text-decoration-color: var(--brand-mid); }
.msg-row.assistant .msg-bubble a:hover { text-decoration-color: var(--brand); }

/* Thinking block */
.msg-row.assistant .msg-bubble details.thinking-block {
  margin: 10px 0; padding: 4px 0 4px 12px;
  border-left: 2px dashed var(--line-2);
  font-size: 12.5px; color: var(--text-3); line-height: 1.55; font-style: italic; opacity: 0.8;
}
.msg-row.assistant .msg-bubble details.thinking-block summary {
  cursor: pointer; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); font-style: normal; list-style: none; user-select: none; padding: 2px 0;
}
.msg-row.assistant .msg-bubble details.thinking-block summary::-webkit-details-marker { display: none; }
.msg-row.assistant .msg-bubble details.thinking-block summary::before { content: '▸'; display: inline-block; margin-right: 6px; color: var(--text-3); }
.msg-row.assistant .msg-bubble details.thinking-block[open] summary::before { content: '▾'; }

/* Tool chip */
.msg-row.assistant .msg-bubble .tool-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; margin: 2px 0;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.4;
  color: var(--text-3); background: var(--brand-light);
  border-radius: 0 4px 4px 0;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-row.assistant .msg-bubble .tool-chip b { color: var(--brand); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; }
.msg-row.assistant .msg-bubble p:has(> .tool-chip:only-child) { margin: 4px 0; }

/* Images in bubbles */
.msg-bubble img { display: block; max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; cursor: zoom-in; }
.msg-bubble img:hover { opacity: 0.9; }
.msg-row.user .msg-bubble img { border-radius: 12px 12px 4px 12px; }
.msg-photo { display: inline-block; max-width: min(280px, 80vw); overflow: hidden; border-radius: 14px 14px 14px 4px; }
.msg-photo img { display: block; width: 100%; max-height: 360px; object-fit: cover; }
.msg-photo-caption { margin: 0; padding: 8px 10px; font-size: 13px; color: var(--text-2); background: var(--bg-hover); border-top: 1px solid var(--line); }
.msg-file { display: inline-block; max-width: min(320px,85vw); border-radius: 12px 12px 12px 4px; overflow: hidden; background: var(--bg-hover); border: 1px solid var(--line-2); }
.msg-file-link { display: flex; align-items: center; gap: 8px; padding: 12px 14px; text-decoration: none; color: var(--text-1); transition: background 0.15s; }
.msg-file-link:hover { background: var(--bg-active); }
.msg-file-icon { font-size: 20px; flex-shrink: 0; }
.msg-file-name { flex: 1; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file-dl { font-size: 14px; color: var(--text-3); flex-shrink: 0; }

/* File attachment links inside bubbles */
.msg-row.assistant .msg-bubble a[href^="/uploads/"],
.msg-row.assistant .msg-bubble a[href^="/api/files/"] {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--radius-sm); background: var(--bg-hover); border: 1px solid var(--line-2);
  color: var(--brand); font-size: 13px; text-decoration: none; margin: 4px 0;
}
.msg-row.assistant .msg-bubble a[href^="/uploads/"]:hover,
.msg-row.assistant .msg-bubble a[href^="/api/files/"]:hover { border-color: var(--brand); }

/* Lightbox */
.img-lightbox { position: fixed; inset: 0; z-index: 999; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; animation: fadeIn 0.15s ease; }
.img-lightbox img { max-width: 92vw; max-height: 88vh; border-radius: var(--radius-sm); box-shadow: 0 24px 60px rgba(0,0,0,0.6); cursor: default; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Empty / loading states */
.chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; flex: 1; color: var(--text-3); font-size: 14px; }
.chat-thinking { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; color: var(--text-3); }
.thinking-dots { display: flex; gap: 3px; }
.thinking-dots span { width: 5px; height: 5px; background: var(--text-4); border-radius: 50%; animation: blink 1.2s infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100% { opacity: 0.3 } 40% { opacity: 1 } }

/* msg-time, system, streaming, activity */
.msg-time {
  font-size: 11px; color: var(--text-3); margin-top: 4px;
  font-family: var(--font-mono); letter-spacing: 0.05em; padding: 0 8px;
}
.msg-row.system { justify-content: center; }
.msg-system {
  background: transparent; border: 1px solid var(--line-2);
  color: var(--text-3); font-size: 13px; padding: 8px 14px;
  border-radius: 10px; max-width: 80%; text-align: center; line-height: 1.6;
}
.msg-system strong { color: var(--text-1); font-weight: 600; }
.msg-streaming::after {
  content: '▌'; display: inline-block; margin-left: 2px;
  color: var(--brand); animation: blink 1s steps(2) infinite;
}
.queued-bubble {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-3); font-size: 13px; font-style: italic;
  background: var(--bg-2); border: 1px dashed var(--line-2); border-radius: 10px;
  padding: 8px 14px;
}
.queued-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); opacity: 0.6;
  animation: blink 1.2s ease-in-out infinite;
  flex-shrink: 0;
}
.msg-activity {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--bg-subtle);
  border: 1px solid var(--line-2); border-radius: 18px;
  font-size: 13px; color: var(--text-3); font-family: var(--font-mono);
  letter-spacing: 0.02em; margin-bottom: 4px; max-width: 72%;
}
.msg-activity-dot {
  width: 6px; height: 6px; background: var(--brand);
  border-radius: 50%; animation: dotPulse 1.4s ease-in-out infinite; flex-shrink: 0;
}
@keyframes dotPulse {
  0%, 100% { opacity: .35; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.1); }
}
.msg-activity-label { color: var(--text-2); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-activity-timer { color: var(--text-3); font-size: 13px; margin-left: auto; font-variant-numeric: tabular-nums; }
.tool-badge { display: inline-block; padding: 2px 8px; background: var(--brand-light); color: var(--brand); border-radius: 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; margin-right: 6px; }
.tool-cmd { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; display: inline-block; vertical-align: middle; }

/* Attachment badges */
.msg-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.msg-attachment-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--line); border-radius: 6px; padding: 2px 8px; font-size: 13px; color: var(--text-3); }
.msg-row.user .msg-attachment-badge { background: rgba(0,0,0,.18); color: white; }
.msg-attachment-clickable { cursor: pointer; transition: opacity .15s; }
.msg-attachment-clickable:hover { opacity: .75; }

/* ═══ CHAT INPUT — Raycast unified container ═══ */
.chat-input-bar {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg); flex-shrink: 0;
}
.chat-input-row-wrap {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.chat-input-row-wrap:focus-within {
  border-color: rgba(28,46,114,0.3);
  box-shadow: 0 0 0 3px rgba(28,46,114,0.06);
}
.file-preview-bar {
  padding: 8px 12px 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.chat-input-row {
  display: flex; align-items: flex-end;
  padding: 10px 10px 10px 14px; gap: 6px;
  position: relative;
}
#chatInput {
  flex: 1; border: none; outline: none; resize: none;
  font-family: var(--font-body); font-size: 14px; line-height: 1.55;
  color: var(--text-1); background: transparent;
  letter-spacing: -0.005em; min-height: 22px; max-height: 160px;
  overflow-y: auto;
}
#chatInput::placeholder { color: var(--text-4); }
.chat-file-btn,.chat-mic {
  width: 30px; height: 30px; border: none; background: transparent;
  border-radius: var(--radius-xs); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); transition: color var(--fast), background var(--fast);
  flex-shrink: 0;
}
.chat-file-btn:hover,.chat-mic:hover { color: var(--text-1); background: var(--bg-hover); }
.chat-mic.recording { color: var(--crimson); }
#chatSendBtn {
  width: 32px; height: 32px; border: none;
  background: var(--brand); color: white;
  border-radius: var(--radius-xs); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity var(--fast); flex-shrink: 0;
}
#chatSendBtn:hover { opacity: 0.85; }
#chatSendBtn:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-abort-btn {
  width: 32px; height: 32px; border: none;
  background: var(--crimson-bg); color: var(--crimson);
  border-radius: var(--radius-xs); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* File chips */
.file-chip { display: flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 8px; font-size: 13px; color: var(--text-3); max-width: 180px; }
.file-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.file-chip-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--line); border-radius: 4px; font-size: 14px; flex-shrink: 0; }
.file-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-chip-remove { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 0; font-size: 14px; line-height: 1; flex-shrink: 0; }
.file-chip-remove:hover { color: var(--text-1); }

/* Drag-over highlight */
.chat-input-bar.drag-over { border-top-color: var(--brand); }

/* Slash menu */
.slash-menu {
  position: absolute; bottom: 100%; left: 14px;
  background: var(--bg-subtle); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 4px;
  min-width: 200px; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  display: none;
}
.slash-menu.open { display: block; }
.slash-item { padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-1); display: flex; align-items: center; gap: 10px; }
.slash-item:hover,.slash-item.active { background: var(--bg-hover); }
.slash-item .slash-key { font-family: var(--font-mono); font-size: 13px; color: var(--brand); min-width: 80px; font-weight: 500; }
.slash-item .slash-desc { font-size: 13px; color: var(--text-2); }

/* File preview modal */
.file-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}
.file-preview-modal {
  background: var(--bg-panel, #1e1e1e);
  border: 1px solid var(--line-2, rgba(255,255,255,.1));
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-width: min(90vw, 960px);
  max-height: 90vh;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.fpm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, rgba(255,255,255,.08));
  flex-shrink: 0;
}
.fpm-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1, #e8e8e8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fpm-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.fpm-btn {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--line, rgba(255,255,255,.1));
  color: var(--text-2, #aaa);
  text-decoration: none;
  transition: background .15s;
}
.fpm-btn:hover { background: var(--line-2, rgba(255,255,255,.18)); }
.fpm-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-2, #aaa);
  font-size: 16px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fpm-close:hover { background: var(--line, rgba(255,255,255,.08)); }
.fpm-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.fpm-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}
.fpm-iframe {
  width: 100%;
  height: 80vh;
  border: none;
  display: block;
}
.fpm-text {
  width: 100%;
  max-height: 80vh;
  overflow: auto;
  padding: 20px;
  margin: 0;
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--text-1, #e8e8e8);
  white-space: pre-wrap;
  word-break: break-word;
  align-self: stretch;
}
.fpm-text.fpm-loading { color: var(--text-3, #666); font-style: italic; }
.fpm-other {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-2, #aaa);
}
.fpm-other-icon { font-size: 48px; }
.fpm-other p { font-size: 14px; }

/* Slash commands popup */
.slash-menu {
  position: absolute;
  bottom: 76px;
  left: 24px;
  right: 24px;
  max-width: 520px;
  background: var(--bg-subtle);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  display: none;
  z-index: 20;
}
.slash-menu.open { display: block; }
.slash-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background var(--fast) var(--ease);
}
.slash-item:hover, .slash-item.active { background: var(--bg-hover); }
.slash-item .slash-key {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brand);
  min-width: 80px;
  font-weight: 500;
}
.slash-item .slash-desc { font-size: 13px; color: var(--text-2); }

/* ═══ DEADLINES ═══ */
.dl-filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; flex-shrink: 0; }
.dl-filter-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--mute);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transition: all var(--fast) var(--ease);
}
.dl-filter-btn:hover, .dl-filter-btn.active {
  color: var(--brand);
  border-color: var(--brand);
}

.dl-project { margin-bottom: 28px; }
.dl-project-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.dl-project-title .count {
  color: var(--dim);
  font-weight: 400;
}

.dl-toggle-btn {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0 8px;
  display: block;
}
.dl-toggle-btn:hover { color: var(--text); }

.dl-card {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  padding: 16px 20px;
  margin-bottom: 8px;
  transition: border-color var(--fast) var(--ease);
}
.dl-card:hover { border-color: var(--line-2); }
.dl-card-top { display: flex; align-items: flex-start; gap: 16px; }

.dl-dday {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  min-width: 60px;
  text-align: center;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  line-height: 1.2;
  border: 1px solid;
}
.dl-dday.overdue { background: var(--crimson-bg); color: var(--crimson); border-color: rgba(220,38,38,0.2); }
.dl-dday.urgent  { background: var(--rust-bg);    color: var(--rust);    border-color: rgba(249,115,22,0.2); }
.dl-dday.soon    { background: var(--ochre-bg);   color: var(--ochre);   border-color: rgba(217,119,6,0.2); }
.dl-dday.ok      { background: var(--sage-bg);    color: var(--sage);    border-color: rgba(22,163,74,0.2); }
.dl-dday.far     { background: transparent; color: var(--text-4); border-color: var(--line-2); }

.dl-info { flex: 1; min-width: 0; }
.dl-title { font-size: 14px; font-weight: 500; line-height: 1.45; color: var(--text-1); }
.dl-meta { font-size: 13px; color: var(--text-3); margin-top: 4px; font-family: var(--font-mono); letter-spacing: 0.02em; }
.dl-actions { display: flex; gap: 6px; flex-shrink: 0; opacity: 0; transition: opacity var(--fast); }
.dl-card:hover .dl-actions { opacity: 1; }

.dl-progress-wrap { margin-top: 14px; }
.dl-progress-bar { height: 2px; background: var(--line-2); border-radius: 1px; overflow: hidden; }
.dl-progress-fill { height: 100%; transition: width var(--slow) var(--ease); background: var(--brand); }
.dl-progress-label { font-size: 13px; color: var(--text-3); margin-top: 5px; text-align: right; cursor: pointer; font-family: var(--font-mono); }
.dl-progress-label:hover { color: var(--brand); }
.dl-edit-wrap { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.dl-edit-input {
  width: 64px; background: var(--bg);
  border: 1px solid var(--brand); border-radius: var(--radius-xs);
  color: var(--text-1); font-size: 13px; padding: 3px 8px;
  outline: none; font-family: var(--font-mono);
}

/* ═══ PROJECTS TAB ═══ */
#projectsList {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}
.proj-group-card {
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  min-width: 0;
}
.proj-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.proj-group-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-1);
}
.proj-group-count {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
  background: var(--line-2);
  padding: 2px 8px;
  border-radius: 99px;
}
.proj-dl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.proj-dl-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--fast);
}
.proj-dl-row:hover { border-color: var(--line-2); }
.proj-dl-row.expanded { border-color: var(--brand-mid); }
.proj-dl-summary { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.proj-dl-info { flex: 1; min-width: 0; }
.proj-dl-title {
  font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proj-dl-actions { display: flex; gap: 6px; flex-shrink: 0; opacity: 0; transition: opacity var(--fast); }
.proj-dl-row:hover .proj-dl-actions { opacity: 1; }
.proj-checklist { padding: 0 14px 12px; border-top: 1px solid var(--line); margin-top: 0; }
.proj-checklist-empty { font-size: 13px; color: var(--text-4); padding: 8px 0 4px; font-style: italic; }
.proj-task-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 6px 0;
  cursor: pointer; font-size: 13px; color: var(--text-1); line-height: 1.4;
  border-bottom: 1px solid var(--line);
}
.proj-task-item:last-child { border-bottom: none; }
.proj-task-item.done .proj-task-title { color: var(--text-3); text-decoration: line-through; }
.proj-task-cb { flex-shrink: 0; margin-top: 2px; accent-color: var(--brand); cursor: pointer; }
.proj-task-title { flex: 1; }
.proj-add-btn {
  display: block; width: 100%; margin-top: 10px; padding: 7px;
  background: transparent; border: 1px dashed var(--line-2);
  border-radius: var(--radius-xs); color: var(--text-3); font-size: 13px;
  cursor: pointer; text-align: center; transition: color var(--fast), border-color var(--fast);
}
.proj-add-btn:hover { color: var(--text-1); border-color: var(--line); }
.proj-activity-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}
.proj-activity-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}
.proj-activity-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 0;
  font-size: 13px;
  flex-wrap: wrap;
  row-gap: 2px;
}
.proj-action-kind {
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  flex-shrink: 0;
  background: var(--line-2);
  color: var(--mute);
}
.proj-action-kind.replan { background: rgba(212,168,75,.15); color: var(--ochre); }
.proj-action-kind.mail { background: rgba(59,130,246,.12); color: var(--brand); }
.proj-action-kind.info { background: rgba(168,85,247,.12); color: #a855f7; }
.proj-activity-summary { flex: 1; min-width: 0; color: var(--dim); line-height: 1.4; }
.proj-activity-time { font-size: 13px; color: var(--mute); font-family: var(--font-mono); flex-shrink: 0; }
.proj-empty {
  text-align: center;
  color: var(--mute);
  font-size: 14px;
  padding: 60px 20px;
  font-style: italic;
}
/* Completed section */
.proj-completed-section {
  grid-column: 1 / -1;
  margin-top: 4px;
}
.proj-completed-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--mute);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 0;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.proj-completed-toggle:hover { color: var(--text-1); }
.proj-completed-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
}
.proj-completed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--mute);
  padding: 4px 0;
  border-bottom: 1px solid var(--line-2);
}
.proj-completed-row:last-child { border-bottom: none; }
.proj-completed-title { flex: 1; }
.proj-completed-date { font-family: var(--font-mono); font-size: 13px; }

/* Responsive */
@media (max-width: 1280px) {
  #projectsList { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  #projectsList { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .proj-group-card { padding: 16px; }
}
@media (max-width: 480px) {
  #projectsList { grid-template-columns: 1fr; gap: 12px; }
  .proj-dl-actions { opacity: 1; }
}

/* ═══ SCHEDULE MODAL ═══ */
.schedule-modal {
  max-width: 600px;
  width: 92vw;
  min-width: 0;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
}
.schedule-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.schedule-modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin: 0;
}
.schedule-modal-close {
  background: none;
  border: none;
  color: var(--mute);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--fast) var(--ease);
  flex-shrink: 0;
}
.schedule-modal-close:hover { color: var(--text-1); }
.schedule-modal-body {
  overflow-y: auto;
  padding: 20px 24px 24px;
  flex: 1;
}

/* ═══ SCHEDULES ═══ */
.sched-card {
  background: var(--bg-subtle);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px 22px;
  margin-bottom: 10px;
  transition: border-color var(--fast) var(--ease);
}
.sched-card:hover { border-color: var(--line-2); }
.sched-top { display: flex; align-items: center; gap: 14px; }
.sched-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  flex: 1;
  letter-spacing: -0.015em;
  color: var(--text-1);
}
.sched-cron {
  font-size: 13px;
  color: var(--brand);
  font-family: var(--font-mono);
  background: var(--brand-light);
  padding: 3px 10px;
  border-radius: 4px;
}
.sched-meta {
  font-size: 13px;
  color: var(--mute);
  margin-top: 10px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}
.sched-actions { display: flex; gap: 8px; margin-top: 12px; }

.toggle-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--fast) var(--ease);
}
.toggle-btn.on { color: var(--sage); border-color: rgba(156,179,155,.3); }
.toggle-btn.off { color: var(--crimson); border-color: rgba(184,92,80,.3); }

/* ═══ MEMORY MODAL ═══ */
.memory-modal {
  max-width: 720px;
  width: 92vw;
  min-width: 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
}
.memory-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.memory-modal-header > div:first-child { flex: 1; }
.memory-modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin: 0;
}
.memory-modal-close {
  background: none;
  border: none;
  color: var(--mute);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color var(--fast) var(--ease);
  flex-shrink: 0;
}
.memory-modal-close:hover { color: var(--text-1); }
.memory-modal-body {
  overflow-y: auto;
  padding: 20px 24px 24px;
  flex: 1;
}
.memory-modal-body.graph-mode { overflow: hidden; }

/* ═══ MEMORY ═══ */
.mem-tabs { display: flex; gap: 4px; }
.mem-tab {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--mute);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mem-tab.active { color: var(--brand); border-color: var(--brand); }

.mem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  align-items: start;
  width: 100%;
}
.mem-card {
  background: var(--bg-subtle);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 16px 18px;
  transition: border-color var(--fast) var(--ease);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mem-card:hover { border-color: var(--line-2); }
.mem-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.mem-cat-pill {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid;
  font-family: var(--font-mono);
}
.mem-importance { font-size: 13px; color: var(--mute); font-family: var(--font-mono); }
.mem-content { font-size: 13px; line-height: 1.6; color: var(--text-1); white-space: pre-wrap; word-break: break-word; flex: 1; }
.mem-tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.mem-tag {
  font-size: 13px;
  color: var(--dim);
  font-family: var(--font-mono);
  background: rgba(139,132,120,.1);
  border-radius: 4px;
  padding: 2px 6px;
}
.mem-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.mem-date { font-size: 13px; color: var(--mute); font-family: var(--font-mono); }
.mem-empty { color: var(--mute); text-align: center; padding: 48px 0; font-size: 13px; }

/* Graph */
#memoryGraph { padding: 4px 0; position: relative; }
.mem-graph-tooltip {
  position: absolute;
  background: rgba(17,17,20,.95);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-1);
  pointer-events: none;
  max-width: 220px;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.mem-graph-tooltip strong { display: block; font-size: 13px; margin-bottom: 3px; }
.mem-graph-tooltip-type {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 6px;
}
.mem-graph-tooltip-rel { font-size: 13px; color: var(--dim); font-family: var(--font-mono); margin-top: 2px; }

/* Graph detail panel */
.mem-graph-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.mem-graph-detail {
  background: var(--bg-subtle);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 24px 24px 20px;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  overflow-y: auto;
  animation: fadeSlideUp 0.18s var(--ease);
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mem-graph-detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.mem-graph-detail-name { font-family: var(--font-display); font-size: 18px; font-weight: 500; color: var(--text-1); }
.mem-graph-detail-meta { font-size: 13px; color: var(--mute); font-family: var(--font-mono); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.06em; }
.mem-graph-detail-close { background: none; border: none; color: var(--mute); font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; }
.mem-graph-detail-close:hover { color: var(--text-1); }
.mem-graph-detail-rels { display: flex; flex-direction: column; gap: 6px; }
.mem-graph-detail-rel {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}
.mem-graph-detail-rel-type {
  font-size: 13px; font-family: var(--font-mono); color: var(--brand);
  text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--brand-light); border-radius: 4px; padding: 2px 7px;
  white-space: nowrap;
}
.mem-graph-detail-rel-nodetype {
  font-size: 13px; color: var(--mute); font-family: var(--font-mono);
  margin-left: auto; text-transform: uppercase; letter-spacing: 0.05em;
}
.mem-graph-detail-empty { font-size: 13px; color: var(--mute); }

/* ═══ APPROVALS TAB ═══ */
#tab-approvals h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-1); margin-bottom: 20px; }
#approvalsList { display: flex; flex-direction: column; gap: 10px; }
.approval-card {
  background: var(--bg-subtle); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 16px 20px;
  display: flex; align-items: flex-start; gap: 16px;
}
.approval-card:hover { border-color: var(--line-2); }
.approval-card-body { flex: 1; min-width: 0; }
.approval-card-title { font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 4px; }
.approval-card-desc { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.approval-card-meta { font-size: 12px; color: var(--text-3); margin-top: 6px; font-family: var(--font-mono); }
.approval-card-actions { display: flex; gap: 8px; flex-shrink: 0; }
.approval-reject { padding: 6px 14px; border: 1px solid var(--crimson); background: transparent; color: var(--crimson); border-radius: var(--radius-xs); font-size: 13px; cursor: pointer; font-family: inherit; transition: background var(--fast); }
.approval-reject:hover { background: var(--crimson-bg); }
.approval-approve { padding: 6px 14px; border: none; background: var(--brand); color: white; border-radius: var(--radius-xs); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; transition: opacity var(--fast); }
.approval-approve:hover { opacity: 0.85; }
.approvals-history { margin-top: 0; }

/* Approvals text tab bar */
.ap-tab-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; }
.ap-tab-btn { background: none; border: none; padding: 0; font-size: 14px; color: var(--text-3); cursor: pointer; font-family: inherit; font-weight: 500; transition: color var(--fast); }
.ap-tab-btn.active { color: var(--text-1); font-weight: 600; }
.ap-tab-btn:hover { color: var(--text-1); }
.ap-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; background: var(--crimson); color: white; border-radius: 9px; font-size: 11px; font-weight: 700; margin-left: 3px; }
.ap-tab-sep { color: var(--line-2); font-size: 13px; }

.approval-hist-title { flex: 1; color: var(--text-1); font-size: 13px; }

/* Approval card sub-elements (legacy) */
.approval-card-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.approval-type { text-transform: uppercase; letter-spacing: .04em; }
.approval-title { font-weight: 600; margin-bottom: 4px; }
.approval-body { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.approval-body.markdown-body h1,.approval-body.markdown-body h2,.approval-body.markdown-body h3 { font-size: 13px; font-weight: 600; color: var(--text-1); margin: 10px 0 4px; }
.approval-body.markdown-body p { margin: 0 0 4px; line-height: 1.5; }
.approval-body.markdown-body ul,.approval-body.markdown-body ol { margin: 0 0 6px; padding-left: 18px; }
.approval-body.markdown-body li { margin: 2px 0; line-height: 1.5; }
.approval-body.markdown-body a { color: var(--brand); }
.approval-body.markdown-body > *:last-child { margin-bottom: 0; }
.approval-actions { display: flex; gap: 8px; }
.approval-note-wrap { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.approval-note { flex: 1 1 100%; resize: vertical; }
.approval-hist-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.approval-hist-status { min-width: 36px; font-weight: 600; }
.approval-rejected { color: var(--crimson); }
.approval-approved { color: var(--sage); }
.approval-modified { color: var(--brand); }
.approval-hist-note { color: var(--text-3); flex: 1 1 auto; min-width: 0; word-break: break-word; }
.approval-time { color: var(--text-3); font-size: 12px; }

/* Shared approval input / inline card styles */
.approval-input {
  flex: 1; min-height: 56px;
  background: var(--bg); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text-1); font-family: inherit; font-size: 13px; outline: none;
}
.approval-input:focus { border-color: var(--brand); }

/* Choice buttons (approvals + inline cards) */
.btn-choice {
  padding: 8px 14px;
  background: var(--bg-subtle); border: 1px solid var(--line-2);
  border-radius: 20px; color: var(--text-1);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background var(--fast), border-color var(--fast); white-space: nowrap;
}
.btn-choice:hover { background: var(--bg-hover); border-color: var(--brand); }
.btn-choice.selected { background: var(--brand); color: white; border-color: var(--brand); }
.btn-choice:disabled { opacity: .5; cursor: default; }

/* Inline approval card */
.approval-inline-card {
  width: 100%; padding: 16px; background: transparent;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  font-size: 14px; line-height: 1.5;
}
.approval-inline-card.answered { border-color: var(--sage); opacity: .75; }
.approval-inline-answered { font-size: 13px; color: var(--sage); font-weight: 500; }
.approval-inline-header { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--brand); margin-bottom: 6px; opacity: .8; }
.approval-inline-question { font-size: 14px; color: var(--text-1); line-height: 1.5; margin-bottom: 12px; }
.approval-inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.approval-inline-input {
  flex: 1; min-width: 160px; min-height: 56px; padding: 7px 12px;
  background: var(--bg-hover); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); color: var(--text-1);
  font-size: 13px; font-family: inherit; outline: none;
}
.approval-inline-input:focus { border-color: var(--brand); }

/* Strategy cards (report tab) */
.strategy-card { max-width: 720px; margin-bottom: 16px; }
.strategy-card-date { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.strategy-divider { border: none; border-top: 2px solid var(--line-2); margin: 24px 0; }
.action-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.action-kind { color: var(--text-3); min-width: 90px; }
.action-summary { flex: 1; }
.action-undone { color: var(--text-3); font-size: 13px; }

/* ═══ INBOX / MEETINGS placeholder ═══ */
.placeholder-coming {
  background: var(--bg-subtle);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 60px 40px;
  text-align: center;
  color: var(--mute);
}
.placeholder-coming h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.placeholder-coming p { font-size: 14px; line-height: 1.6; max-width: 380px; margin: 0 auto; }
.placeholder-coming .label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brand);
  background: var(--brand-light);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ═══ SETTINGS TAB ═══ */
.settings-section { margin-bottom: 32px; }
.settings-section > h3, .settings-section h3 { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 0 0 10px; margin: 0; }
.settings-form { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.form-group input, .form-group textarea, .form-group select {
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color var(--fast) var(--ease);
}
.form-group input, .form-group select { min-height: 40px; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--brand); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.form-msg { font-size: 13px; min-height: 20px; margin-top: 6px; font-family: var(--font-mono); }
.form-msg.ok { color: var(--sage); }
.form-msg.err { color: var(--crimson); }
.dl-form-error { font-size: 13px; color: var(--crimson); background: var(--crimson-bg); border-radius: 6px; padding: 7px 10px; margin-bottom: 10px; display: none; }

.settings-row { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: none; }
.settings-row label { font-size: 13px; color: var(--text-1); flex: 1; }
.settings-row-label { font-size: 13px; color: var(--text-1); flex: 1; }
.settings-row .settings-desc,.settings-row-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.settings-toggle-btn { padding: 6px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-xs); background: transparent; color: var(--text-2); font-size: 13px; cursor: pointer; font-family: inherit; transition: all var(--fast); }
.settings-toggle-btn:hover,.settings-toggle-btn.active { background: var(--brand); border-color: var(--brand); color: white; }
.settings-row-mobile-only { display: none; }

.settings-nav-row { cursor: pointer; }
.settings-nav-row:hover { background: var(--bg-hover); }
.settings-nav-chevron { font-size: 22px; color: var(--text-3); line-height: 1; }

/* Settings sub-panel (depth navigation) */
.settings-subpanel {
  position: absolute;
  inset: 0;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  overflow-y: auto;
}
.settings-subpanel.open { transform: translateX(0); }
.settings-subpanel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.settings-subpanel-back {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 15px;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.settings-subpanel-back:hover { opacity: 0.8; }
.settings-subpanel-body { padding: 20px 24px 40px; max-width: 520px; }

.env-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.env-row:last-child { border-bottom: none; }
.env-row-main { display: flex; align-items: center; gap: 10px; }
.env-row-key { flex: 1; font-size: 13px; color: var(--text-1); word-break: break-all; }
.env-row-status { font-size: 13px; color: var(--mute); white-space: nowrap; }
.env-del-btn { background: none; border: none; color: var(--mute); font-size: 18px; cursor: pointer; line-height: 1; padding: 2px 4px; }
.env-del-btn:hover { color: var(--crimson); }
.env-edit-wrap { display: none; margin-top: 12px; flex-direction: column; gap: 8px; }
.env-edit-wrap.open { display: flex; }

/* ═══ MODALS ═══ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: var(--bg-overlay); backdrop-filter: blur(4px);
  z-index: 9999; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal { position: fixed; inset: 0; z-index: 9999; background: var(--bg-overlay); display: flex; align-items: center; justify-content: center; }
.modal-box {
  background: var(--bg); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 24px;
  min-width: 300px; max-width: 440px; width: 90vw;
  box-shadow: 0 16px 48px rgba(0,0,0,0.12);
  display: flex; flex-direction: column; gap: 14px;
}
.modal-box h3 { font-size: 16px; font-weight: 700; color: var(--text-1); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text-1); margin: 0; }
.modal-close {
  background: none; border: none; color: var(--text-3);
  font-size: 20px; cursor: pointer; line-height: 1; padding: 0 4px;
  transition: color var(--fast) var(--ease); border-radius: var(--radius-xs);
}
.modal-close:hover { color: var(--text-1); background: var(--bg-hover); }

/* ═══ COMMAND PALETTE (Cmd+K) ═══ */
.palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(10px);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
}
.palette-overlay.open { display: flex; animation: fadeIn 180ms var(--ease); }
@keyframes fadeIn { from { opacity: 0; } }
.palette {
  width: 580px;
  max-width: 92vw;
  background: var(--bg-subtle);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: slideUp 220ms var(--ease);
}
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } }
.palette-input {
  width: 100%;
  min-height: 56px;
  background: transparent;
  border: none;
  padding: 20px 24px;
  color: var(--text-1);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  outline: none;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--line);
}
.palette-input::placeholder { color: var(--mute); font-style: italic; }
.palette-body { padding: 10px 0; max-height: 400px; overflow-y: auto; }
.palette-section-title {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brand);
  padding: 10px 24px 4px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.palette-item {
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}
.palette-item:hover, .palette-item.active { background: var(--bg-hover); }
.palette-item-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 14px;
}
.palette-item-label { flex: 1; font-size: 14px; color: var(--text-1); }
.palette-item-hint { font-family: var(--font-mono); font-size: 13px; color: var(--mute); letter-spacing: 0.05em; }
.palette-footer {
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.palette-footer kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  margin-right: 4px;
  font-family: inherit;
  color: var(--text-2);
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(244,239,228,.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(244,239,228,.16); }

/* ═══ EMPTY STATE ═══ */
.empty-state {
  font-family: var(--font-display);
  color: var(--mute);
  text-align: center;
  padding: 80px 20px;
  font-size: 16px;
  font-style: italic;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
  .today-grid { grid-template-columns: 1fr; gap: 18px; }
  .today-hero { grid-template-columns: 1fr; gap: 8px; padding-bottom: 14px; margin-bottom: 8px; }
  .today-date { text-align: left; }
  .today-greeting { font-size: 28px; }
}

/* Tablet — tighter margins, full-width content */
@media (max-width: 768px) {
  /* Tighter tab padding — was 28px 32px 32px */
  .tab { padding: 16px 16px 20px; gap: 14px; }
  .tab-header { margin-bottom: 4px; }
  .tab-header h2 { font-size: 24px; }

  /* Chat edge-to-edge */
  #tab-chat { padding: 0 !important; gap: 0; }
  .chat-header { padding: 10px 14px; }
  .msg-row.user .msg-bubble { max-width: 86%; padding: 10px 14px; font-size: 13.5px; }
  .msg-row.assistant .msg-bubble { padding: 12px 14px; font-size: 13.5px; }
  .chat-messages { padding: 14px 16px; gap: 10px; }
  .chat-input-bar { padding: 10px 14px; gap: 8px; min-width: 0; }
  .chat-input-bar textarea { padding: 10px 14px; min-width: 0; }
  .chat-input-bar button { width: 40px; height: 40px; flex-shrink: 0; }
  .chat-mic { width: 36px !important; height: 36px !important; flex-shrink: 0; }

  /* Today dashboard */
  .today-greeting { font-size: 28px; }
  .today-hero { padding-bottom: 10px; margin-bottom: 4px; }
  .today-quick { grid-template-columns: 1fr 1fr; gap: 8px; }
  .today-quick button { padding: 12px 14px; font-size: 13px; }
  .today-section { gap: 10px; }
  .today-item { padding: 10px 0; }
  .today-brief { padding: 14px 16px; }

  /* Deadlines */
  .dl-project { margin-bottom: 18px; }
  .dl-card { padding: 12px 14px; }
  .dl-card-top { flex-wrap: wrap; gap: 10px; }
  .dl-actions { opacity: 1; }

  /* Schedules / Memory / Settings */
  .sched-card { padding: 14px 16px; }
  .sched-meta { gap: 12px; }
  .mem-card { padding: 13px 14px; }
  .settings-section { padding: 20px; }

  /* Forms */
  .form-row { flex-direction: column; gap: 10px; }
  .modal { width: 96vw; padding: 20px; }

  /* Approvals */
  .ap-content-area { padding: 16px; }
  .approval-actions { flex-direction: column; gap: 6px; align-items: stretch; }
  .approval-actions .btn-primary,
  .approval-actions .btn-secondary,
  .approval-actions .btn-danger { text-align: center; }

  /* Session sidebar (mobile drawer) — slide in/out */
  .session-sidebar {
    display: flex; /* always rendered, off-screen by default */
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 52;
    width: 260px;
    box-shadow: 8px 0 32px rgba(0,0,0,.3);
    border-radius: 0;
    border-right: 1px solid var(--line);
    transform: translateX(-260px);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0.28s;
    visibility: hidden; /* prevent focus trap when off-screen */
  }
  .session-sidebar.mobile-open {
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0s;
    visibility: visible;
  }
  .session-close-btn { display: flex !important; }
  .session-toggle {
    display: flex !important;
    color: var(--brand) !important;
  }
  .session-toggle:hover { color: var(--brand) !important; background: var(--brand-light) !important; }
}

@media (max-width: 480px) {
  /* Settings: show logout row only on mobile */
  .settings-row-mobile-only { display: flex; }

  main { padding-bottom: 0; }
  .tab { padding: 12px 12px 16px; gap: 12px; }
  .tab-header { margin-bottom: 4px; }
  .tab-header h2 { font-size: 22px; }

  /* Chat — edge-to-edge */
  #tab-chat { padding: 0 !important; gap: 0; }
  .chat-header { padding: 10px 14px; }
  #tab-chat .chat-messages { padding: 12px 14px 90px; gap: 10px; }
  .chat-input-bar {
    position: fixed; bottom: env(safe-area-inset-bottom, 0px); left: 0; right: 0; z-index: 49;
    padding: 8px 10px; min-width: 0;
  }
  .chat-input-row { gap: 6px; }
  .chat-input-bar textarea {
    padding: 10px 14px; font-size: 15px; /* 15px prevents iOS zoom on focus */
    min-width: 0; flex: 1 1 auto;
  }
  .chat-input-bar button { width: 44px; height: 44px; flex-shrink: 0; }
  .chat-mic { width: 42px !important; height: 42px !important; flex-shrink: 0; }
  .chat-container { padding-bottom: 0; }

  /* Today */
  .today-greeting { font-size: 26px; line-height: 1.1; }
  .today-date { font-size: 13px; }
  .today-hero { padding-bottom: 10px; margin-bottom: 4px; gap: 6px; }
  .today-quick { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .today-quick button { padding: 10px 6px; font-size: 13px; gap: 4px; min-height: 44px; justify-content: center; }
  .today-quick button .key { display: none; }
  .today-main { grid-template-columns: 1fr; overflow-x: hidden; }
  .today-main > * { min-width: 0; }
  .today-sidebar { position: static; margin-top: 8px; }
  .ms-chip { min-width: calc(50vw - 16px); max-width: calc(60vw); }
  .today-grid { gap: 14px; }
  .today-section { gap: 8px; }
  .today-item { padding: 13px 0; min-height: 48px; }
  .today-item-marker { width: 42px; font-size: 13px; }
  .today-item-title { font-size: 13px; }
  .today-item-meta { font-size: 13px; }
  .today-brief { padding: 12px 14px; }
  .today-brief-body { font-size: 13px; max-height: 120px; }

  /* Messages */
  .msg-bubble { max-width: 85%; font-size: 13px; padding: 9px 13px; }
  .msg-row.assistant .msg-bubble { max-width: 100%; }
  .msg-activity { max-width: 100%; }
  .tool-cmd { max-width: calc(100% - 80px); }
  .chat-session-name { font-size: 14px; }
  .session-sidebar { width: 260px; }

  /* Deadlines — always show actions on mobile (no hover), bigger tap targets */
  .dl-actions { opacity: 1; }
  .dl-actions .btn-sm { padding: 10px 14px; font-size: 13px; min-height: 42px; }
  .dl-dday { min-width: 50px; font-size: 13px; padding: 4px 6px; }
  .dl-title { font-size: 13px; }
  .dl-card { padding: 12px 14px; }
  .dl-card-top { gap: 10px; }

  /* Memory — bigger delete button */
  .mem-footer .btn-sm { padding: 10px 14px; font-size: 13px; min-height: 40px; }
  .mem-tab { padding: 8px 14px; min-height: 40px; }

  /* Schedules — bigger toggle/run buttons */
  .toggle-btn { padding: 10px 16px; font-size: 13px; min-height: 42px; }
  .sched-actions .btn-primary { padding: 10px 16px; min-height: 42px; }

  /* Palette */
  .palette { width: 94vw; }
  .palette-input { font-size: 17px; padding: 14px 18px; }
}

/* ═══ REPORT TAB ═══ */
.report-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-shrink: 0;
}
.report-header h2 {
  font-size: 22px; font-weight: 700; letter-spacing: -0.03em; color: var(--text-1);
}
.report-nav { display: flex; gap: 8px; }

.report-tab-switcher {
  display: flex; gap: 2px; margin-bottom: 16px; flex-shrink: 0;
}
.report-sub-tab {
  padding: 6px 14px; border: none; background: transparent;
  color: var(--text-3); font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit; border-radius: var(--radius-xs);
  transition: color var(--fast), background var(--fast);
  letter-spacing: -0.005em;
}
.report-sub-tab:hover { color: var(--text-1); background: var(--bg-hover); }
.report-sub-tab.active { color: var(--brand); font-weight: 600; background: var(--brand-light); }

.report-meta {
  font-size: 12px; color: var(--text-3);
  margin-bottom: 16px; font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.report-content { flex: 1; }

/* Markdown in report */
.report-content h2 {
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-1); margin: 24px 0 8px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.report-content h3 {
  font-size: 14px; font-weight: 700; color: var(--text-2);
  margin: 16px 0 6px; text-transform: uppercase; letter-spacing: 0.06em;
}
.report-content h4 { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 12px 0 4px; }
.report-content p { font-size: 14px; color: var(--text-2); line-height: 1.7; margin: 0 0 10px; }
.report-content ul,.report-content ol { padding-left: 20px; margin: 0 0 10px; }
.report-content li { font-size: 14px; color: var(--text-2); line-height: 1.7; margin: 3px 0; }
.report-content li::marker { color: var(--brand); }
.report-content strong { font-weight: 600; color: var(--text-1); }
.report-content code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-hover); padding: 1px 5px; border-radius: 4px; color: var(--brand); border: 1px solid var(--line-2); }
.report-content pre { background: var(--bg-hover); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; margin: 10px 0; }
.report-content pre code { background: transparent; border: none; padding: 0; color: var(--text-1); }
.report-content table { display: block; overflow-x: auto; border-collapse: collapse; min-width: 100%; margin: 12px 0; font-size: 13px; }
.report-content th,.report-content td { border: 1px solid var(--line-2); padding: 7px 12px; text-align: left; }
.report-content th { background: var(--bg-hover); font-weight: 600; color: var(--text-1); }
.report-content td { color: var(--text-2); }
.report-content hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.report-content a { color: var(--brand); }
.report-content blockquote { padding: 0 0 0 12px; margin: 10px 0; color: var(--text-2); font-style: italic; }
.report-content .report-quote { font-size: 13px; color: var(--text-3); font-style: italic; margin: 4px 0 10px; }
.report-empty { font-size: 14px; color: var(--text-3); text-align: center; padding: 60px 0; }

/* D-day inline tag */
.d-tag { font-size: 11px; font-weight: 700; color: var(--crimson); letter-spacing: 0.02em; margin-right: 4px; }

/* Report inline summary line */
.report-summary-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-2); margin-bottom: 20px;
}
.summary-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.summary-dot.urgent { background: var(--crimson); }
.summary-dot.done { background: var(--sage); }
.summary-sep { color: var(--text-3); font-size: 11px; }

/* ═══ REPORT SCROLL AREA ═══ */
.report-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.report-scroll-area > * {
  width: 100%;
  max-width: 720px;
}

/* ═══ REPORT CAROUSEL ═══ */
.report-carousel-section {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg);
  border-top: 1px solid var(--line-2);
  padding: 12px 0;
  height: 148px;
  overflow: hidden;
}
.carousel-arrow {
  flex-shrink: 0;
  width: 40px;
  height: 100%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--fast);
  z-index: 1;
}
.carousel-arrow:hover { color: var(--text-1); }
.carousel-arrow:disabled { opacity: 0.2; cursor: default; }

.report-carousel {
  flex: 1;
  min-width: 0;
  position: relative;
  height: 124px;
  overflow: hidden;
}

/* Individual carousel card */
.carousel-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 160px;
  background: var(--bg-subtle);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 320ms cubic-bezier(.25,.8,.25,1),
              opacity 320ms cubic-bezier(.25,.8,.25,1),
              border-color var(--fast),
              background var(--fast);
  transform-origin: center center;
  user-select: none;
  will-change: transform, opacity;
}
.carousel-card:hover { border-color: var(--brand); }
.carousel-card.active {
  background: var(--brand-light);
  border-color: var(--brand);
}
.cc-date {
  font-size: 13px; font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.cc-kind {
  font-size: 11px; font-weight: 500;
  color: var(--text-3);
}
.cc-time {
  font-size: 11px;
  color: var(--text-4);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.cc-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.cc-urgent {
  font-size: 10px; font-weight: 600;
  color: var(--rust);
  background: var(--rust-bg);
  padding: 1px 6px;
  border-radius: 10px;
}
.cc-auto {
  font-size: 10px; font-weight: 600;
  color: var(--sage);
  background: var(--sage-bg);
  padding: 1px 6px;
  border-radius: 10px;
}

/* ═══ ACTIONS DRAWER ═══ */

/* Trigger — 우측 고정 세로 탭 */
/* Actions wrap — trigger + drawer를 하나로 묶어 함께 슬라이드 */
.actions-wrap {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  z-index: 199;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.actions-wrap > * { pointer-events: auto; }
.actions-wrap.has-actions {
  /* trigger tab만 보임 */
  transform: translateX(calc(100% - 34px));
}
.actions-wrap.open {
  transform: translateX(0);
}

.actions-trigger {
  flex-shrink: 0;
  width: 34px;
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 8px 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--fast) var(--ease);
  box-shadow: -2px 0 10px rgba(28,46,114,0.15);
  align-self: center;
  height: 100px;
  overflow: hidden;
}
.actions-trigger:hover { background: var(--brand-hover); }
.actions-trigger span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
}

/* Drawer overlay */
.actions-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 198;
}
.actions-drawer-overlay.open { display: block; }

/* Drawer panel */
.actions-drawer {
  width: 400px;
  max-width: 90vw;
  background: var(--bg);
  border-left: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.actions-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
  flex-shrink: 0;
}
.actions-drawer-title {
  font-size: 14px; font-weight: 600;
  color: var(--text-1);
}
.actions-drawer-close {
  background: none; border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px; border-radius: 4px;
  display: flex; align-items: center;
  transition: color var(--fast), background var(--fast);
}
.actions-drawer-close:hover { color: var(--text-1); background: var(--bg-hover); }

/* Action items — 세로 목록 */
.actions-cards-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}
.action-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.action-item:last-child { border-bottom: none; }
.action-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-kind {
  font-size: 11px; font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.action-item-time {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-left: auto;
}
.action-summary {
  font-size: 13px; color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}
.action-undone {
  font-size: 11px; color: var(--text-4);
  margin-top: 2px;
}
.action-undo-btn {
  align-self: flex-start;
  font-size: 12px;
  margin-top: 4px;
}
/* empty state */
.actions-empty {
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 13px;
}

/* ═══ WEATHER TAB ═══ */
.wt-controls { display: flex; align-items: center; gap: 10px; }
.wt-controls select { border: 1px solid var(--line-2); border-radius: var(--radius-xs); padding: 6px 10px; font-size: 13px; font-family: inherit; color: var(--text-1); background: var(--bg); outline: none; }
#wtSummary { margin-bottom: 16px; }
.wt-summary-card { background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 20px; margin-bottom: 10px; }
.wt-summary-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.wt-summary { display: flex; gap: 16px; margin-bottom: 14px; font-size: 14px; color: var(--text-3); }
.wt-summary b { color: var(--text-1); }
.wt-summary .wt-rec b { color: var(--ochre); }
.wt-summary .wt-fail b { color: var(--crimson); }
#wtTimeline { display: flex; flex-direction: column; gap: 8px; }
.wt-day { margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.wt-day-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--bg-subtle); border-bottom: 1px solid var(--line); }
.wt-row { background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 12px 16px; display: flex; align-items: center; gap: 16px; font-size: 13px; flex-wrap: wrap; }
.wt-row.wt-missing { opacity: 0.85; }
.wt-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); width: 80px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.wt-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.wt-desc { flex: 1; color: var(--text-2); }
.wt-temp { font-family: var(--font-mono); font-weight: 700; color: var(--text-1); }
.wt-stat { font-size: 12px; color: var(--text-3); }
.wt-detail { color: var(--text-3); font-size: 13px; }
.wt-vdetail { flex-basis: 100%; padding-left: 54px; }
.wt-badge { font-size: 12px; padding: 2px 8px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.wt-ok,.wt-pass { background: var(--sage-bg); color: var(--sage); }
.wt-warn,.wt-recovered { background: var(--ochre-bg); color: var(--ochre); }
.wt-failed { background: var(--rust-bg); color: var(--rust); }
.wt-catchup { background: var(--brand-light); color: var(--brand); }
.wt-empty { color: var(--text-3); padding: 24px 0; text-align: center; }
.wt-kind { font-size: 12px; padding: 2px 9px; border-radius: 20px; font-weight: 700; white-space: nowrap; }
.wt-kind-short { background: var(--brand-light); color: var(--brand); }
.wt-kind-mid { background: rgba(126,34,206,0.08); color: #7e22ce; }
@media (max-width: 480px) { .wt-vdetail { padding-left: 0; } }

/* ═══ CALENDAR TAB ═══ */

.cal-wrap { display: flex; flex-direction: column; height: 100%; gap: 0; }

/* Header */
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; flex-wrap: wrap; gap: 12px;
}
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-title { font-size: 18px; font-weight: 600; color: var(--text-1); min-width: 120px; text-align: center; }
.cal-today-btn { font-size: 13px; padding: 4px 10px; }
.cal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Calendar grid approach (plan style) */
.cal-grid-plan { display: grid; grid-template-columns: 1fr 200px; gap: 20px; }
.cal-month { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.cal-month-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cal-month-title { font-size: 14px; font-weight: 700; color: var(--text-1); letter-spacing: -0.01em; }
.cal-nav-btn { background: transparent; border: none; cursor: pointer; color: var(--text-3); padding: 4px 8px; border-radius: var(--radius-xs); font-size: 16px; }
.cal-nav-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.cal-dow { display: grid; grid-template-columns: repeat(7,1fr); border-bottom: 1px solid var(--line); }
.cal-dow span { text-align: center; padding: 8px 0; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-days { display: grid; grid-template-columns: repeat(7,1fr); }
.cal-upcoming { display: flex; flex-direction: column; gap: 8px; }
.cal-upcoming-title { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.cal-upcoming-item { background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 10px 12px; }
.cal-upcoming-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.cal-upcoming-name { font-size: 13px; font-weight: 500; color: var(--text-1); margin-top: 2px; }

/* Filter chips */
.cal-filters { display: flex; gap: 6px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cal-filters::-webkit-scrollbar { display: none; }
.cal-filter-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; border: 1px solid var(--line-2);
  background: var(--bg-subtle); color: var(--mute); font-size: 13px; cursor: pointer;
  transition: all var(--fast) var(--ease);
}
.cal-filter-chip.active { border-color: var(--chip-color); color: var(--text-1); background: color-mix(in srgb, var(--chip-color) 15%, transparent); }
.cal-filter-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--chip-color); }

/* View toggle */
.cal-view-toggle { display: flex; gap: 4px; }
.cal-view-toggle .btn-secondary { font-size: 13px; padding: 4px 10px; }
.cal-view-toggle .btn-secondary.active { border-color: var(--brand); color: var(--brand); }

/* Sync btn */
#calSyncBtn { display: flex; align-items: center; gap: 5px; font-size: 13px; padding: 4px 10px; }
#calSyncBtn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Month view: unified grid (header + cells share same 7-col grid) ── */
.cal-wd {
  text-align: center; font-size: 10px; font-weight: 700;
  color: var(--text-4); letter-spacing: 0.06em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-2);
  background: var(--bg-subtle);
}

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  /* grid-template-rows set dynamically by JS: 36px header + N×1fr */
  flex: 1; min-height: 0; border-top: 1px solid var(--line); overflow: hidden;
}

.cal-cell {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 5px 6px 4px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden; min-height: 0;
  transition: background var(--fast);
}
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell.other-month { opacity: 0.45; background: var(--bg-subtle); }
.cal-cell.other-month:hover { opacity: 0.65; }
.cal-cell.today { background: var(--brand-light); }
.cal-cell.selected { outline: 2px solid var(--brand); outline-offset: -1px; background: color-mix(in srgb, var(--brand) 4%, var(--bg)); z-index: 1; }
.cal-cell.sat:not(.today):not(.other-month) { background: color-mix(in srgb, #6B8EE8 3%, var(--bg)); }
.cal-cell.sun:not(.today):not(.other-month) { background: color-mix(in srgb, #E86B6B 3%, var(--bg)); }

.cal-day-num {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 12px; font-weight: 500; color: var(--text-2); flex-shrink: 0;
}
.cal-cell.today .cal-day-num { background: var(--brand); color: #fff; font-weight: 700; }
.cal-cell.other-month .cal-day-num { color: var(--text-4); }

.cal-cell-events { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal-event-pill {
  display: flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500; line-height: 1.5;
  padding: 1.5px 5px; border-radius: 3px;
  background: color-mix(in srgb, var(--ec) 10%, transparent);
  color: var(--ec);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0;
}
.cal-event-more { font-size: 10px; color: var(--text-3); padding: 1px 5px; cursor: pointer; }
.cal-event-more:hover { color: var(--text-1); }

/* ── Detail panel — right slide-in ── */
.cal-detail {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 292px; background: var(--bg);
  border-left: 1px solid var(--line-2);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1);
  z-index: 20; box-shadow: -6px 0 24px rgba(0,0,0,0.06);
}
.cal-detail.open { transform: translateX(0); }
.cal-detail-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.cal-detail-header span { font-size: 14px; font-weight: 700; color: var(--text-1); }
.cal-detail-body { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.cal-detail-item {
  border-radius: var(--radius-sm); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid color-mix(in srgb, var(--ec, var(--line)) 18%, transparent);
  background: color-mix(in srgb, var(--ec, var(--bg-subtle)) 8%, var(--bg));
  transition: filter var(--fast);
}
.cal-detail-item:hover { filter: brightness(0.97); }
.cal-detail-item-cat { font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ec); }
.cal-detail-item-title { font-size: 13px; font-weight: 600; color: var(--text-1); line-height: 1.4; }
.cal-detail-item-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.cal-detail-item-meta a { color: var(--brand); text-decoration: none; }
.cal-detail-progress { height: 3px; background: var(--line-2); border-radius: 2px; margin-top: 6px; }
.cal-detail-progress-bar { height: 100%; background: var(--sage); border-radius: 2px; transition: width 0.3s; }
.cal-empty { font-size: 13px; color: var(--text-3); padding: 40px 0; text-align: center; }

/* Opps view */
#calOppsView { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cal-opps-header { padding: 12px 20px; border-bottom: 1px solid var(--line-2); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.cal-opps-tabs, .cal-opps-status-tabs { display: flex; gap: 6px; }
.cal-opp-tab, .cal-status-tab {
  padding: 4px 12px; border-radius: 20px; border: 1px solid var(--line-2);
  background: transparent; color: var(--mute); font-size: 13px; cursor: pointer;
  transition: all var(--fast) var(--ease);
}
.cal-opp-tab.active, .cal-status-tab.active { border-color: var(--brand); color: var(--brand); }

.cal-opps-list { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }

.cal-opp-card {
  display: flex; gap: 0; border-radius: var(--radius-sm); background: var(--bg-subtle);
  border: 1px solid var(--line-2); overflow: hidden;
  transition: border-color var(--fast) var(--ease);
}
.cal-opp-card:hover { border-color: var(--line-2); }
.cal-opp-card-left {
  flex: 1; padding: 14px 16px;
}
.cal-opp-card-type { font-size: 13px; color: var(--mute); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.cal-opp-card-title { font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 3px; }
.cal-opp-card-org { font-size: 13px; color: var(--mute); margin-bottom: 5px; }
.cal-opp-card-desc { font-size: 13px; color: var(--text-3); line-height: 1.5; margin-bottom: 6px; }
.cal-opp-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cal-tag { font-size: 13px; padding: 2px 7px; border-radius: 10px; background: var(--line); color: var(--text-3); }

.cal-opp-card-right { padding: 14px 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 90px; flex-shrink: 0; }
.cal-opp-days { font-size: 20px; font-weight: 700; line-height: 1; }
.cal-opp-deadline-label, .cal-opp-briefing-label { font-size: 13px; color: var(--mute); white-space: nowrap; }
.cal-opp-actions { display: flex; gap: 4px; margin-top: auto; }
.cal-opp-link { font-size: 13px; padding: 3px 8px; text-decoration: none; color: var(--brand); }
.cal-opp-status-btn { font-size: 13px; padding: 3px 8px; }
.cal-opp-del { color: var(--crimson); }

/* Calendar body layout */
.cal-body { flex: 1; display: flex; flex-direction: row; min-height: 0; overflow: hidden; }
.cal-main-content { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#calendarView { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

/* Calendar agent chat panel — collapsed by default, full width grid */
.cal-chat-panel { display: none; }
.cal-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.cal-chat-title { font-size: 13px; font-weight: 600; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }
.cal-chat-context {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--bg-subtle); border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--text-3); flex-shrink: 0;
}
.cal-chat-ctx-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-chat-ctx-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chat-ctx-remove { background: none; border: none; color: var(--mute); cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1; }
.cal-chat-ctx-remove:hover { color: var(--text-1); }
.cal-chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cal-chat-hint { font-size: 13px; color: var(--mute); line-height: 1.6; text-align: center; margin: auto; padding: 20px 8px; }
.cal-chat-msg { display: flex; flex-direction: column; }
.cal-chat-msg-user { align-items: flex-end; }
.cal-chat-msg-assistant { align-items: flex-start; }
.cal-chat-msg-content {
  font-size: 13px; line-height: 1.55; padding: 7px 10px; border-radius: var(--radius-sm);
  max-width: 92%; word-break: break-word;
}
.cal-chat-msg-user .cal-chat-msg-content { background: var(--brand); color: #000; }
.cal-chat-msg-assistant .cal-chat-msg-content { background: var(--bg-subtle); color: var(--text-1); }
.cal-chat-typing { color: var(--mute); font-style: italic; }
.cal-chat-input-area {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; border-top: 1px solid var(--line); flex-shrink: 0;
}
.cal-chat-input-area textarea {
  width: 100%; background: var(--bg-subtle); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text-1); font-size: 13px;
  padding: 7px 10px; resize: none; font-family: inherit; line-height: 1.5;
  box-sizing: border-box;
}
.cal-chat-input-area textarea:focus { outline: none; border-color: var(--brand); }
.cal-chat-send-btn { width: 100%; font-size: 13px; padding: 6px; }

/* Event tag button in detail panel */
.cal-detail-item-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.cal-detail-tag-btn {
  flex-shrink: 0; background: none; border: 1px solid var(--line);
  color: var(--mute); font-size: 13px; padding: 2px 5px; border-radius: 4px;
  cursor: pointer; transition: all var(--fast) var(--ease); margin-top: 2px;
}
.cal-detail-tag-btn:hover { border-color: var(--brand); color: var(--brand); }
.cal-detail-chat-btn {
  flex-shrink: 0; background: none; border: 1px solid var(--line);
  color: var(--mute); font-size: 13px; padding: 2px 7px; border-radius: 4px;
  cursor: pointer; transition: all var(--fast) var(--ease); margin-top: 2px;
}
.cal-detail-chat-btn:hover { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.cal-detail-item-clickable { cursor: pointer; }
.cal-detail-item-clickable:hover .cal-detail-item-title { text-decoration: underline; color: var(--brand); }

/* ═══ BUSINESS TAB ═══ */
#tab-business { padding-bottom: 40px; }
.biz-header-actions { display: flex; gap: 8px; align-items: center; }
.biz-content { display: flex; flex-direction: column; gap: 16px; }
.biz-loading, .biz-empty { color: var(--text-3); font-size: 14px; padding: 32px 0; text-align: center; }

.biz-section { margin-bottom: 28px; }
.biz-section-icon { display: none; }
.biz-section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.biz-section-icon { display: none; }
.biz-section-title { font-size: 11px; font-weight: 700; color: var(--text-3); margin: 0; text-transform: uppercase; letter-spacing: 0.06em; }

.biz-fields { display: flex; flex-direction: column; }
.biz-row,.biz-field {
  display: flex; align-items: center; padding: 10px 16px; gap: 12px;
  border-bottom: 1px solid var(--line); transition: background var(--fast) var(--ease);
}
.biz-row:last-child,.biz-field:last-child { border-bottom: none; }
.biz-row:hover,.biz-field:hover { background: var(--bg-hover); }

.biz-label { font-size: 13px; color: var(--text-3); min-width: 140px; flex-shrink: 0; }
.biz-field-right { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.biz-value { font-size: 13px; color: var(--text-1); font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-value-empty { color: var(--text-4); font-style: italic; font-size: 13px; }

.biz-value-input {
  flex: 1; min-width: 0; background: transparent; border: 1px solid var(--line-2);
  border-radius: var(--radius-xs); padding: 4px 8px;
  font-size: 13px; color: var(--text-1); font-family: var(--font-mono);
  outline: none; transition: border-color var(--fast) var(--ease);
}
.biz-value-input:focus { border-color: var(--brand); }

.biz-field-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.biz-copy-btn,.biz-reveal-btn {
  background: transparent; border: none; color: var(--text-3); cursor: pointer;
  padding: 4px 8px; border-radius: var(--radius-xs); font-size: 12px;
  transition: color var(--fast), background var(--fast); opacity: 0.4;
}
.biz-field:hover .biz-copy-btn,.biz-field:hover .biz-reveal-btn { opacity: 0.8; }
.biz-copy-btn:hover,.biz-reveal-btn:hover { background: var(--bg-hover); color: var(--text-1); opacity: 1; }
.biz-copied { color: var(--sage) !important; opacity: 1 !important; }

.biz-delete { opacity: 0; transition: opacity var(--fast), color var(--fast); background: transparent; border: none; color: var(--text-3); cursor: pointer; padding: 4px 8px; border-radius: var(--radius-xs); }
.biz-field:hover .biz-delete { opacity: 0.5; }
.biz-delete:hover { opacity: 1 !important; color: var(--rust) !important; }

.biz-download-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-xs);
  color: var(--text-2); font-size: 13px; text-decoration: none;
  transition: border-color var(--fast), color var(--fast); white-space: nowrap;
}
.biz-download-btn:hover { border-color: var(--brand); color: var(--brand); }
.biz-download-btn svg { flex-shrink: 0; }

/* Tax modal */
.biz-modal-overlay { position: fixed; inset: 0; z-index: 900; background: var(--bg-overlay); display: flex; align-items: center; justify-content: center; }
.biz-modal { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 24px; min-width: 320px; max-width: 480px; width: 90vw; box-shadow: 0 16px 48px rgba(0,0,0,0.1); }
.biz-modal-title { font-size: 16px; font-weight: 700; color: var(--text-1); margin: 0 0 16px; }
.biz-tax-modal { width: 400px; }
.biz-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.biz-modal-header .biz-modal-title { margin: 0; }
.biz-modal-close { background: transparent; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: var(--radius-xs); }
.biz-modal-close:hover { color: var(--text-1); background: var(--bg-hover); }

.biz-tax-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.biz-tax-row { display: flex; justify-content: space-between; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.biz-tax-label,.biz-tax-key { color: var(--text-3); white-space: nowrap; min-width: 100px; flex-shrink: 0; }
.biz-tax-value,.biz-tax-val { color: var(--text-1); font-weight: 500; }

.biz-modal-form { display: flex; flex-direction: column; gap: 12px; }
.biz-modal-form label { font-size: 13px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.biz-modal-form input,.biz-modal-form select { border: 1px solid var(--line-2); border-radius: var(--radius-xs); padding: 8px 12px; min-height: 40px; font-size: 13px; font-family: inherit; color: var(--text-1); background: var(--bg); outline: none; }
.biz-modal-form input:focus,.biz-modal-form select:focus { border-color: var(--brand); }
.biz-checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; cursor: pointer; }
.biz-checkbox-label input[type=checkbox] { width: auto; }
.biz-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Card widgets */
.biz-card-widget { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.biz-card-widget:last-child { border-bottom: none; }
.biz-card-inner { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.biz-card-name { font-size: 13px; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-card-number { font-size: 14px; color: var(--text-1); font-family: var(--font-mono); letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-card-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: 12px; }
.biz-card-actions .biz-copy-btn,.biz-card-actions .biz-reveal-btn { opacity: 0.5; }
.biz-card-widget:hover .biz-card-actions .biz-copy-btn,.biz-card-widget:hover .biz-card-actions .biz-reveal-btn { opacity: 0.9; }

.biz-card-edit-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.biz-card-edit-row:last-child { border-bottom: none; }
.biz-card-idx-label { font-size: 13px; color: var(--text-4); white-space: nowrap; min-width: 38px; flex-shrink: 0; }
.biz-card-edit-row .biz-card-name-input { flex: 1; min-width: 0; }
.biz-card-edit-row .biz-card-num-input  { flex: 1.6; min-width: 0; font-family: var(--font-mono); letter-spacing: 0.06em; }
.biz-card-row-actions { display: flex; align-items: center; flex-shrink: 0; }

.biz-add-card-btn { margin-left: auto; font-size: 13px; padding: 3px 9px; background: transparent; border: 1px solid var(--line-2); color: var(--text-3); border-radius: 5px; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.biz-add-card-btn:hover { color: var(--text-1); border-color: var(--line-2); }


/* Mobile */
@media (max-width: 600px) {
  .biz-label { min-width: 100px; font-size: 13px; }
  .biz-value { font-size: 13px; }
  .biz-header-actions .btn-secondary:first-child { display: none; }
  .biz-card-edit-row { flex-wrap: wrap; gap: 6px 8px; }
  .biz-card-idx-label { width: 100%; margin-bottom: 0; }
  .biz-card-edit-row .biz-card-name-input,
  .biz-card-edit-row .biz-card-num-input { flex: 1 1 calc(50% - 20px); min-width: 110px; }
}

/* ═══ PROJECTS (OPP) TAB ═══ */
.opp-layout { display: flex; flex: 1; min-height: 0; position: relative; overflow: hidden; }
.opp-sidebar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 240px;
  background: var(--bg-subtle); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
  z-index: 52;
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0,0,0,.1);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.22s;
}
.opp-sidebar.collapsed {
  transform: translateX(-100%);
  box-shadow: none;
  pointer-events: none;
}
.opp-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.opp-sidebar-title { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.opp-summary-bar { padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.opp-list { flex: 1; overflow-y: auto; padding: 6px; }
.opp-close-btn { display: flex; }
.opp-toggle-btn { display: flex; }

/* Sidebar items — new style */
.opp-item {
  padding: 8px 10px; border-radius: var(--radius-xs);
  cursor: pointer; margin-bottom: 1px;
  transition: background var(--fast); border: 1px solid transparent;
}
.opp-item:hover { background: var(--bg-hover); }
.opp-item.active { background: var(--bg-active-t); border-color: var(--brand-mid); }
.opp-item-title { font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-item.active .opp-item-title { color: var(--text-1); font-weight: 600; }
.opp-item-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; gap: 8px; align-items: center; }
.opp-dday { font-family: var(--font-mono); font-size: 11px; padding: 1px 6px; border-radius: 10px; font-weight: 600; }
.opp-dday.overdue { background: var(--rust-bg); color: var(--crimson); }
.opp-dday.urgent  { background: var(--ochre-bg); color: var(--ochre); }
.opp-dday.normal  { background: var(--sage-bg); color: var(--sage); }
.opp-dday.soon    { background: var(--ochre-bg); color: var(--ochre); }

/* Legacy opp-card style */
.opp-card { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); transition: background 0.1s; }
.opp-card:hover { background: var(--bg-hover); }
.opp-card.active { background: var(--bg-active-t); }
.opp-card-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.opp-card-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 8px; align-items: center; }
.opp-type-badge { padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--brand-light); color: var(--brand); }
.opp-type-badge.hackathon { background: var(--sage-bg); color: var(--sage); }
.opp-type-badge.grant     { background: var(--brand-light); color: var(--brand); }
.opp-type-badge.contest   { background: var(--ochre-bg); color: var(--ochre); }

.opp-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.opp-main-header {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: 48px;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.opp-main-title { font-size: 14px; font-weight: 600; color: var(--text-1); letter-spacing: -0.01em; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp-content { flex: 1; overflow-y: auto; padding: 24px; }
.opp-empty-state { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-3); font-size: 14px; text-align: center; flex-direction: column; gap: 4px; }
.opp-empty-sub { display: block; font-size: 13px; color: var(--text-4); }

/* OPP Detail */
.opp-detail { padding: 0; }
.opp-detail-header { margin-bottom: 20px; }
.opp-detail-header h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: var(--text-1); }
.opp-detail-meta { font-size: 12px; color: var(--text-3); margin-bottom: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.opp-chat-start-btn { margin-left: auto; }
.opp-detail-meta a { color: var(--brand); text-decoration: none; }
.opp-detail-meta a:hover { text-decoration: underline; }

/* Pipeline */
.opp-pipeline-wrap { margin-bottom: 20px; }
.opp-pipeline { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: var(--radius-sm); overflow: hidden; }
.opp-stage,.opp-stage-step {
  flex: 1; padding: 10px 12px; text-align: center;
  font-size: 12px; font-weight: 500; color: var(--text-3);
  background: var(--bg-subtle); border-right: 1px solid var(--line);
  cursor: pointer; transition: background var(--fast), color var(--fast);
}
.opp-stage:last-child,.opp-stage-step:last-child { border-right: none; }
.opp-stage:hover,.opp-stage-step:hover { background: var(--bg-hover); color: var(--text-1); }
.opp-stage.active,.opp-stage-step.active { background: var(--brand); color: white; font-weight: 600; }
.opp-stage.done,.opp-stage-step.done { background: var(--sage-bg); color: var(--sage); }

/* OPP Tasks/Docs sections */
.opp-tasks-section,.opp-docs-section { margin-bottom: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.opp-section-title { font-size: 10px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
.opp-task-item,.opp-task-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.opp-task-item:last-child,.opp-task-row:last-child { border-bottom: none; }
.opp-task-item input[type="checkbox"],.opp-task-check { accent-color: var(--brand); width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }
.opp-task-title { flex: 1; }
.opp-task-done,.opp-task-title.done { text-decoration: line-through; color: var(--text-4); }
.opp-jurin-help-btn { font-size: 11px; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--text-3); background: transparent; cursor: pointer; white-space: nowrap; transition: color var(--fast), border-color var(--fast); }
.opp-jurin-help-btn:hover { color: var(--brand); border-color: var(--brand); }

/* OPP Documents */
.opp-doc-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.opp-doc-info { display: flex; flex-direction: column; gap: 2px; }
.opp-doc-title { font-size: 14px; font-weight: 500; color: var(--text-1); }
.opp-doc-meta { font-size: 12px; color: var(--text-3); }
.opp-doc-status { font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.opp-doc-status.draft   { background: var(--ochre-bg); color: var(--ochre); }
.opp-doc-status.writing { background: var(--brand-light); color: var(--brand); }
.opp-doc-status.done    { background: var(--sage-bg); color: var(--sage); }
.opp-doc-open-btn { font-size: 12px; padding: 3px 10px; border-radius: 5px; border: 1px solid var(--line); cursor: pointer; background: transparent; color: var(--text-3); transition: color var(--fast), border-color var(--fast); }
.opp-doc-open-btn:hover { color: var(--text-1); border-color: var(--text-3); }

/* OPP Editor */
.opp-editor { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.opp-editor-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.btn-back { background: transparent; border: none; color: var(--brand); font-size: 13px; cursor: pointer; font-family: inherit; padding: 4px 0; }
.opp-editor-doc-title { font-size: 14px; font-weight: 600; color: var(--text-1); flex: 1; }
.opp-editor-saved { font-size: 12px; color: var(--sage); }
.opp-editor-body { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.opp-editor-textarea {
  flex: 1; border: none; outline: none; resize: none;
  padding: 20px; font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  color: var(--text-1); background: var(--bg);
  border-right: 1px solid var(--line);
}
.opp-editor-chat-panel { width: 280px; display: flex; flex-direction: column; flex-shrink: 0; }
.opp-editor-chat-messages { flex: 1; overflow-y: auto; padding: 12px; }
.opp-editor-chat-msg { padding: 8px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5; max-width: 90%; margin-bottom: 8px; }
.opp-editor-chat-msg.user { background: var(--brand); color: white; align-self: flex-end; }
.opp-editor-chat-msg.assistant { background: var(--bg-hover); color: var(--text-1); align-self: flex-start; }
.opp-editor-chat-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.opp-editor-chat-input { flex: 1; border: 1px solid var(--line-2); border-radius: var(--radius-xs); padding: 6px 10px; font-size: 13px; font-family: inherit; color: var(--text-1); background: var(--bg); outline: none; }
.opp-editor-chat-input:focus { border-color: var(--brand); }



/* ── Proactive AI PM ────────────────────────────────────────────────────── */

/* PM Panel (C surface) */
.opp-pm-panel {
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 20px;
  margin-bottom: 0;
  background: transparent;
}
.opp-pm-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.opp-pm-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 1;
}
.opp-pm-panel-refresh {
  font-size: 11px;
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}
.opp-pm-panel-refresh:hover { background: var(--line-2); }
.opp-pm-readiness-bar {
  height: 6px;
  background: var(--line-2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}
.opp-pm-readiness-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.opp-pm-readiness-fill.urgent { background: #ef4444; }
.opp-pm-assessment {
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.5;
  margin-bottom: 12px;
}
.opp-pm-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.opp-pm-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.opp-pm-action-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-1);
  line-height: 1.4;
}
.opp-pm-action-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  min-width: 16px;
  padding-top: 1px;
}
.opp-pm-risks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.opp-pm-risk-item {
  font-size: 12px;
  color: var(--rust);
  padding: 2px 0;
  background: none;
}
.opp-pm-pending {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  padding: 16px 0;
}
.opp-pm-generated {
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  margin-top: 8px;
}

/* Profile editor */
.opp-profile-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 10px;
  line-height: 1.5;
}
.opp-profile-textarea {
  width: 100%;
  min-height: 200px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--text-1);
  color: var(--bg);
  resize: vertical;
  box-sizing: border-box;
}
.opp-profile-textarea:focus {
  outline: none;
  border-color: var(--brand);
}

/* ═══════════════════════════════════════════════════════════════════
   CALENDAR v2 — Cron.com inspired redesign
   ═══════════════════════════════════════════════════════════════════ */

/* Shell: sidebar + main */
.cal-shell {
  display: flex; flex: 1; height: 100%; overflow: hidden; position: relative;
}

/* ── Left sidebar ── */
.cal-sidebar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 240px;
  background: var(--bg-subtle); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  z-index: 52;
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0,0,0,.1);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.22s;
}
.cal-sidebar.collapsed {
  transform: translateX(-100%);
  box-shadow: none;
  pointer-events: none;
}
.cal-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.cal-sidebar-title { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.cal-close-btn { display: flex; }

/* Mini calendar */
.cal-mini { padding: 16px 12px 10px; }
.cal-mini-nav {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.cal-mini-title { font-size: 13px; font-weight: 600; color: var(--text-1); letter-spacing: -0.01em; }
.cal-mini-nav-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-3); padding: 4px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: color var(--fast), background var(--fast);
}
.cal-mini-nav-btn:hover { color: var(--text-1); background: var(--bg-hover); }

.cal-mini-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 3px;
}
.cal-mini-weekdays span {
  text-align: center; font-size: 10px; font-weight: 600;
  color: var(--text-4); padding: 2px 0;
}

.cal-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }

.cal-mini-day {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2px 0; min-height: 26px;
  font-size: 11px; font-weight: 400; color: var(--text-2);
  background: transparent; border: none; border-radius: 6px;
  cursor: pointer; transition: background var(--fast), color var(--fast);
}
.cal-mini-dots {
  display: flex; align-items: center; justify-content: center;
  gap: 2px; height: 5px; margin-top: 1px;
}
.cal-mini-dot {
  width: 4px; height: 4px; border-radius: 50%; flex-shrink: 0;
}
.cal-mini-dot-more {
  font-size: 7px; color: var(--text-3); line-height: 1;
}
.cal-mini-day:hover { background: var(--bg-hover); color: var(--text-1); }
.cal-mini-day.other { color: var(--text-4); }
.cal-mini-day.sun { color: var(--crimson); }
.cal-mini-day.sat { color: var(--sage); }
.cal-mini-day.today {
  background: color-mix(in srgb, var(--brand) 10%, var(--bg));
  color: var(--brand); font-weight: 700; border-radius: 6px;
  outline: 1.5px solid var(--brand); outline-offset: -1.5px;
}
.cal-mini-day.today.sun, .cal-mini-day.today.sat { color: var(--brand); }
.cal-mini-day.selected:not(.today) {
  background: var(--brand-light); color: var(--brand); font-weight: 600; border-radius: 50%;
}

/* Sidebar sections */
.cal-sidebar-divider { height: 1px; background: var(--line); margin: 2px 0; }
.cal-sidebar-section { padding: 10px 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.cal-sidebar-label {
  font-size: 10px; font-weight: 700; color: var(--text-4);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 5px; padding: 0 2px;
}

/* Sidebar filter list */
.cal-sidebar-filter-list { display: flex; flex-direction: column; gap: 1px; }
.cal-sidebar-filter {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  border-radius: var(--radius-xs); background: transparent; border: none; cursor: pointer;
  font-size: 13px; color: var(--text-3); font-family: inherit;
  transition: background var(--fast), color var(--fast); text-align: left;
}
.cal-sidebar-filter:hover { background: var(--bg-hover); color: var(--text-1); }
.cal-sidebar-filter.active { color: var(--text-1); }
.cal-sidebar-filter-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: transparent; border: 2px solid var(--chip-color);
  transition: background var(--fast);
}
.cal-sidebar-filter.active .cal-sidebar-filter-dot { background: var(--chip-color); border-color: var(--chip-color); }

/* Sidebar action buttons */
.cal-sidebar-action-btn {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px;
  border-radius: var(--radius-xs); background: transparent; border: none; cursor: pointer;
  font-size: 13px; color: var(--text-2); font-family: inherit;
  transition: background var(--fast), color var(--fast); text-align: left;
}
.cal-sidebar-action-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.cal-sidebar-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cal-sidebar-add-btn { color: var(--brand); }
.cal-sidebar-add-btn:hover { background: var(--brand-light); }

/* ── Main panel ── */
.cal-main-panel {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
  position: relative;
}

/* Main header */
.cal-main-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  flex-shrink: 0; gap: 10px; flex-wrap: wrap; min-height: 48px;
}
.cal-main-nav { display: flex; align-items: center; gap: 4px; }
.cal-title {
  font-size: 15px; font-weight: 600; color: var(--text-1);
  min-width: 130px; letter-spacing: -0.02em; margin: 0 2px;
}
.cal-today-btn { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.cal-main-actions { display: flex; align-items: center; gap: 8px; }

/* View pills */
.cal-view-pills {
  display: flex; background: var(--bg-hover); border-radius: 6px; padding: 2px; gap: 1px;
}
.cal-view-pill {
  padding: 4px 11px; border-radius: 4px; border: none;
  background: transparent; font-size: 13px; font-weight: 500;
  color: var(--text-3); cursor: pointer; font-family: inherit;
  transition: all var(--fast) var(--ease);
}
.cal-view-pill:hover { color: var(--text-1); }
.cal-view-pill.active {
  background: var(--bg); color: var(--text-1); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* Mobile-only elements */
.cal-sidebar-toggle { display: flex; }
.cal-mobile-add { display: none; min-height: 30px; padding: 4px 10px; font-size: 13px; }

/* View containers */
.cal-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

/* ── Week view ── */
.cal-week-header { border-bottom: 1px solid var(--line); flex-shrink: 0; }
.cal-week-head-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week-col-head {
  padding: 10px 6px 7px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-right: 1px solid var(--line); cursor: pointer;
}
.cal-week-col-head:last-child { border-right: none; }
.cal-week-dow { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.cal-week-date-num {
  font-size: 14px; font-weight: 500; color: var(--text-2);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.cal-week-date-num.today-dot { background: var(--brand); color: white; font-weight: 700; }
.cal-week-col-head.today .cal-week-dow { color: var(--brand); font-weight: 700; }
.cal-week-col-head.sun .cal-week-dow { color: var(--crimson); }
.cal-week-col-head.sat .cal-week-dow { color: var(--sage); }

.cal-week-body { flex: 1; overflow-y: auto; }
.cal-week-cells-row { display: grid; grid-template-columns: repeat(7, 1fr); min-height: 100%; }
.cal-week-cell {
  padding: 6px 3px; border-right: 1px solid var(--line);
  min-height: 120px; cursor: pointer;
  transition: background var(--fast);
  display: flex; flex-direction: column; gap: 3px;
}
.cal-week-cell:last-child { border-right: none; }
.cal-week-cell:hover { background: var(--bg-hover); }
.cal-week-cell.today { background: var(--brand-light); }
.cal-week-cell.selected { background: color-mix(in srgb, var(--brand) 7%, transparent); outline: 1px solid var(--brand); outline-offset: -1px; }

.cal-week-event {
  display: flex; align-items: flex-start; gap: 4px; padding: 3px 4px;
  border-radius: 3px; background: color-mix(in srgb, var(--ec) 12%, transparent);
  transition: background var(--fast);
}
.cal-week-event:hover { background: color-mix(in srgb, var(--ec) 20%, transparent); }
.cal-week-event-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ec); flex-shrink: 0; margin-top: 4px;
}
.cal-week-event-text {
  font-size: 11px; line-height: 1.4;
  color: color-mix(in srgb, var(--ec) 85%, var(--text-1));
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ── Week view: time axis ── */
.cal-week-head-row {
  display: grid; grid-template-columns: 48px repeat(7, 1fr);
}
.cal-wk-gutter-head {
  border-right: 1px solid var(--line); background: var(--bg-subtle);
}
/* Override col-head for time-axis layout */
.cal-week-col-head {
  padding: 8px 4px 6px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border-right: 1px solid var(--line); cursor: pointer;
}
.cal-week-col-head:last-child { border-right: none; }
.cal-week-col-head:hover { background: var(--bg-hover); }
.cal-week-dow { font-size: 10px; font-weight: 700; color: var(--text-3); letter-spacing: 0.05em; text-transform: uppercase; }
.cal-week-date-num {
  font-size: 20px; font-weight: 600; color: var(--text-2);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; margin-top: 2px;
}
.cal-week-col-head.today .cal-week-dow { color: var(--brand); font-weight: 700; }
.cal-week-col-head.today .cal-week-date-num { background: var(--brand); color: #fff; }
.cal-week-col-head.selected:not(.today) .cal-week-date-num { border: 2px solid var(--brand); color: var(--brand); }

/* All-day band */
.cal-week-allday {
  display: grid; grid-template-columns: 48px repeat(7, 1fr);
  border-bottom: 1px solid var(--line); flex-shrink: 0; min-height: 28px;
}
.cal-wk-allday-label {
  background: var(--bg-subtle); border-right: 1px solid var(--line);
  font-size: 9px; color: var(--text-4);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.cal-wk-allday-col {
  border-right: 1px solid var(--line); padding: 3px;
  display: flex; flex-direction: column; gap: 2px;
}
.cal-wk-allday-col:last-child { border-right: none; }

/* Scrollable time body */
.cal-week-time-body {
  flex: 1; overflow-y: auto;
  display: grid; grid-template-columns: 48px repeat(7, 1fr);
  align-items: start; scrollbar-gutter: stable;
}
.cal-wk-time-col {
  position: sticky; left: 0; background: var(--bg-subtle);
  border-right: 1px solid var(--line); z-index: 1;
}
.cal-wk-time-slot {
  height: 56px; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 3px; font-size: 9px; color: var(--text-3); font-weight: 600;
  letter-spacing: 0.02em;
}
.cal-wk-day-col {
  border-right: 1px solid var(--line); position: relative;
  min-height: 672px; /* 12h × 56px */
}
.cal-wk-day-col:last-child { border-right: none; }
.cal-wk-day-col.today { background: var(--brand-light); }
.cal-wk-hour-line {
  position: absolute; left: 0; right: 0; height: 56px;
  border-bottom: 1px solid var(--line); pointer-events: none;
}
.cal-wk-now-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--crimson); z-index: 2;
}
.cal-wk-now-line::before {
  content: ''; position: absolute; left: -4px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--crimson);
}
.cal-wk-ev-block {
  position: absolute; left: 3px; right: 3px;
  border-radius: 5px; padding: 3px 6px;
  font-size: 11px; font-weight: 500;
  overflow: hidden; cursor: pointer; z-index: 1;
  line-height: 1.35; border-left: 3px solid transparent;
  transition: filter var(--fast);
  background: color-mix(in srgb, var(--ec) 13%, #fff);
  color: var(--ec); border-color: var(--ec);
}
.cal-wk-ev-block:hover { filter: brightness(0.94); }
.cal-wk-ev-time { font-size: 9.5px; opacity: 0.7; margin-bottom: 1px; }

/* ── Calendar mobile ── */
@media (max-width: 768px) {
  .cal-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 52;
    width: 240px;
    overflow: visible;
    transform: translateX(-240px);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0.28s;
    visibility: hidden;
  }
  .cal-sidebar.mobile-open {
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0s;
    visibility: visible;
    box-shadow: 8px 0 32px rgba(0,0,0,.25);
  }
  .cal-sidebar-toggle { display: flex !important; }
  .cal-mobile-add { display: flex !important; }
  .cal-main-header { padding: 7px 10px; min-height: 44px; }
  .cal-title { min-width: 90px; font-size: 14px; }
  .cal-week-cell { min-height: 70px; }
  .cal-week-event-text { -webkit-line-clamp: 1; }
  .cal-cell { min-height: 60px; }
}
@media (max-width: 480px) {
  .cal-title { font-size: 13px; min-width: 72px; }
  .cal-week-col-head { padding: 6px 2px; }
  .cal-week-dow { font-size: 10px; }
  .cal-week-date-num { font-size: 12px; width: 22px; height: 22px; }
  .cal-week-cell { padding: 2px 1px; min-height: 52px; }
  .cal-view-pill { padding: 3px 7px; font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════
   PROJECTS TAB — mobile drawer fix
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .opp-layout { position: relative; }
  .opp-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 52;
    width: min(280px, 85vw);
    overflow: visible;
    transform: translateX(min(-280px, -85vw));
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0.28s;
    visibility: hidden; background: var(--bg);
  }
  .opp-sidebar.mobile-open {
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0s;
    visibility: visible;
    box-shadow: 8px 0 32px rgba(0,0,0,.25);
  }
  .opp-close-btn { display: flex !important; }
  .opp-toggle-btn { display: flex !important; }
  .opp-main { width: 100%; min-width: 0; }
  .opp-content { padding: 14px; }
  .opp-detail-actions { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════
   REPORT TAB — max-width for readability
   ═══════════════════════════════════════════════════════════════════ */
.report-header,
#reportContent,
#reportMeta {
  max-width: 760px;
}

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS TAB — consistent button widths
   ═══════════════════════════════════════════════════════════════════ */
.settings-row > button,
.settings-row > a {
  min-width: 88px; text-align: center; justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════════
   NAV — mobile gradient fade hint
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  #nav { position: relative; }
  #nav::after {
    content: ''; position: absolute; right: 0; top: 0; bottom: 0;
    width: 40px; pointer-events: none;
    background: linear-gradient(to right, transparent, var(--bg-subtle));
  }
}

/* ═══════════════════════════════════════════════════════════════════
   FULL REDESIGN v2 — All Tabs
   ═══════════════════════════════════════════════════════════════════ */

/* ── Global: empty state, section labels ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 64px 24px; text-align: center; color: var(--text-3);
}
.empty-state-icon { font-size: 32px; opacity: 0.4; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-state-desc { font-size: 13px; line-height: 1.6; max-width: 280px; }
.section-label {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

/* ── Report tab ── */
.report-section-divider {
  border: none; border-top: 1px solid var(--line); margin: 20px 0 0;
}
#reportContent h3 {
  font-size: 13px; font-weight: 700; color: var(--brand);
  margin: 16px 0 8px; letter-spacing: 0.03em; text-transform: uppercase;
}
#reportContent h4 {
  font-size: 13px; font-weight: 600; color: var(--text-2); margin: 12px 0 5px;
}
#reportContent blockquote.report-quote {
  border-left: 3px solid var(--brand-mid); padding: 8px 14px;
  color: var(--text-2); font-size: 14px; margin: 12px 0;
  background: var(--bg-subtle); border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}
#reportContent li { margin: 5px 0; line-height: 1.65; }
#reportContent li::marker { color: var(--text-4); }
.d-tag {
  display: inline-block; padding: 1px 6px;
  background: var(--crimson-bg); color: var(--crimson);
  border-radius: 4px; font-size: 12px; font-weight: 700;
  font-family: var(--font-mono); margin: 0 2px;
}

/* ── Approvals tab ── */
#tab-approvals {
  max-width: none; padding: 0 !important; gap: 0;
}

/* Tab bar — full-width strip at top */
.ap-tab-bar {
  display: flex; align-items: center; flex-shrink: 0;
  padding: 0 32px; border-bottom: 1px solid var(--line); margin-bottom: 0;
  background: var(--bg);
}
.ap-tab-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 0; margin-right: 24px;
  background: transparent; border: none;
  font-size: 13px; font-weight: 500; color: var(--text-3);
  cursor: pointer; font-family: inherit; position: relative;
  transition: color var(--fast);
}
.ap-tab-btn:hover { color: var(--text-1); }
.ap-tab-btn.active { color: var(--brand); font-weight: 600; }
.ap-tab-btn.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--brand); border-radius: 2px 2px 0 0;
}
.ap-tab-count {
  background: var(--crimson); color: white;
  font-size: 11px; font-weight: 700; padding: 1px 6px;
  border-radius: 10px; min-width: 18px; text-align: center;
}
.ap-tab-sep { display: none; }

/* Scrollable content area */
.ap-content-area {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 24px 32px; background: var(--bg-subtle);
  display: flex; flex-direction: column; align-items: center;
}
/* Centered inner container */
.ap-inner { width: 100%; max-width: 640px; }
#approvalsList { display: flex; flex-direction: column; gap: 10px; }

/* Approval card */
.approval-card {
  display: block;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
  transition: border-color var(--fast);
}
.approval-card:hover { border-color: var(--line-2); }
.approval-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 9px; border-bottom: 1px solid var(--line);
}
.approval-type {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--brand);
  background: var(--brand-light); padding: 2px 8px; border-radius: 4px;
}
/* Type badge colour variants */
.approval-type.type-external-post { background: var(--ochre-bg); color: var(--ochre); }
.approval-type.type-delete        { background: var(--rust-bg);  color: var(--rust);  }
.approval-type.type-schedule      { background: #EDE9FE; color: #6D28D9; }
.approval-type.type-create-document { background: var(--sage-bg); color: var(--sage); }
.approval-type.type-other         { background: var(--bg-hover); color: var(--text-3); }

.approval-time { font-size: 12px; color: var(--text-3); font-family: var(--font-mono); }
.approval-title {
  padding: 10px 14px 4px; font-size: 14px; font-weight: 600;
  color: var(--text-1); line-height: 1.4; letter-spacing: -0.01em;
}
.approval-body {
  padding: 0 14px 12px; font-size: 13px; color: var(--text-2);
  line-height: 1.65;
}
.approval-actions { display: flex; gap: 8px; padding: 10px 14px 12px; }
.approval-actions .btn-primary,
.approval-actions .btn-secondary,
.approval-actions .btn-danger { min-height: 32px; padding: 5px 14px; font-size: 12px; }
.approval-note-wrap {
  padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--line);
}
.approval-note {
  width: 100%; padding: 8px 12px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--line-2); border-radius: var(--radius-xs);
  background: var(--bg); color: var(--text-1); resize: none; outline: none;
  line-height: 1.55; transition: border-color var(--fast); box-sizing: border-box;
}
.approval-note:focus { border-color: var(--brand); }
.approval-note-actions { display: flex; justify-content: flex-end; gap: 8px; }
.approval-note-actions .btn-primary,
.approval-note-actions .btn-secondary { min-height: 32px; padding: 5px 14px; font-size: 12px; }

/* History */
.approval-hist-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px;
  flex-wrap: wrap;
}
.approval-hist-row:last-child { border-bottom: none; }
.approval-hist-status {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.approval-approved { background: var(--sage-bg); color: var(--sage); }
.approval-rejected { background: var(--rust-bg); color: var(--rust); }
.approval-modified { background: var(--ochre-bg); color: var(--ochre); }
.approval-hist-title { flex: 1; color: var(--text-2); line-height: 1.4; min-width: 0; }
.approval-hist-note { color: var(--text-3); font-style: italic; font-size: 12px; }

/* Mobile: 2-row grid to prevent title char-wrapping */
@media (max-width: 639px) {
  .approval-hist-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    align-items: start;
    gap: 4px 8px;
    flex-wrap: unset;
  }
  .approval-hist-row .approval-hist-status { grid-area: 1 / 1; align-self: center; }
  .approval-hist-row .approval-hist-title  { grid-area: 1 / 2; word-break: break-word; }
  .approval-hist-row .approval-time        { grid-area: 1 / 3; align-self: center; white-space: nowrap; }
  .approval-hist-row .approval-hist-note   { grid-area: 2 / 1 / 3 / 4; padding-left: 0; }
}

/* ── Weather tab ── */
.wt-summary-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px;
}
.wt-stat-card {
  background: var(--bg-subtle); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.wt-stat-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-3);
}
.wt-stat-value {
  font-size: 28px; font-weight: 700; font-family: var(--font-mono);
  letter-spacing: -0.04em; color: var(--text-1); line-height: 1.1;
}
.wt-stat-card.pass .wt-stat-value { color: var(--sage); }
.wt-stat-card.recovered .wt-stat-value { color: var(--ochre); }
.wt-stat-card.failed .wt-stat-value { color: var(--crimson); }
.wt-day {
  margin-bottom: 16px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
.wt-day-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg-subtle);
  border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 700; color: var(--text-1);
}
.wt-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.wt-row:last-child { border-bottom: none; }
.wt-empty { color: var(--text-3); font-size: 14px; padding: 32px 0; text-align: center; }
@media (max-width: 600px) {
  .wt-summary-cards { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .wt-stat-value { font-size: 22px; }
  .wt-stat-card { padding: 12px; }
}

/* ── Settings tab ── */
#tab-settings { max-width: 680px; overflow-y: auto; }
.settings-section {
  background: var(--bg-subtle); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 16px;
}
.settings-section h3 {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 16px 10px; border-bottom: 1px solid var(--line);
  background: var(--bg); margin: 0;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; gap: 16px; border-bottom: 1px solid var(--line);
  transition: background var(--fast);
}
.settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: var(--bg-hover); }
.settings-row-label { font-size: 13px; font-weight: 500; color: var(--text-1); margin-bottom: 2px; }
.settings-row-desc { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.settings-row > button, .settings-row > a {
  min-width: 80px; text-align: center; justify-content: center;
  min-height: 34px; padding: 6px 14px; font-size: 13px; flex-shrink: 0;
}

/* ── Projects sidebar card refinement ── */
.opp-card {
  padding: 11px 14px 11px 14px; border-radius: 0;
  cursor: pointer; border-bottom: 1px solid var(--line);
  transition: background var(--fast); border-left: 3px solid transparent;
}
.opp-card:hover { background: var(--bg-hover); }
.opp-card.active {
  background: var(--bg-active-t); border-left-color: var(--brand);
}
.opp-card-title {
  font-size: 13px; font-weight: 500; color: var(--text-1);
  line-height: 1.35; margin-bottom: 5px; letter-spacing: -0.005em;
}
.opp-card.active .opp-card-title { font-weight: 600; }
.opp-card-meta { display: flex; align-items: center; gap: 6px; }
.opp-type-badge {
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0;
}
.opp-type-badge.hackathon { background: rgba(220,38,38,0.08); color: #b91c1c; }
.opp-type-badge.grant { background: rgba(217,119,6,0.1); color: #b45309; }
.opp-type-badge.accelerator { background: rgba(22,163,74,0.1); color: #15803d; }
.opp-type-badge.contest { background: rgba(28,46,114,0.08); color: #1C2E72; }
.opp-dday { font-size: 12px; font-weight: 700; font-family: var(--font-mono); }
.opp-dday.urgent { color: var(--crimson); }
.opp-dday.soon { color: var(--ochre); }
.opp-dday.ok { color: var(--sage); }

/* Pipeline stepper */
.opp-pipeline {
  display: flex; align-items: flex-start;
  padding: 16px 4px 14px; margin-bottom: 4px;
  border: none; border-radius: 0; overflow: visible;
}
.opp-pipeline-wrap { border-bottom: 1px solid var(--line); margin-bottom: 0; }
.opp-step {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; cursor: pointer; min-width: 0;
}
.opp-step-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line-2); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 1; flex-shrink: 0;
  transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
}
.opp-step.done .opp-step-dot {
  background: var(--sage); border-color: var(--sage);
}
.opp-step.active .opp-step-dot {
  background: var(--brand); border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(28,46,114,0.12); width: 22px; height: 22px; margin-top: -1px;
}
.opp-step-dot-inner {
  width: 8px; height: 8px; border-radius: 50%; background: #fff;
}
.opp-step-line {
  flex: 1; height: 2px; margin-top: 9px; flex-shrink: 0;
  background: var(--line); min-width: 4px;
}
.opp-step-line.done { background: var(--sage); }
.opp-step-line.partial { background: linear-gradient(to right, var(--sage), var(--brand)); }
.opp-step-label {
  font-size: 10px; font-weight: 400; color: var(--text-3);
  margin-top: 5px; white-space: nowrap; text-align: center;
}
.opp-step.done .opp-step-label { color: var(--text-3); }
.opp-step.active .opp-step-label { color: var(--brand); font-weight: 700; font-size: 11px; }
.opp-step:hover .opp-step-dot { border-color: var(--brand); }

/* Section titles in detail */
.opp-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}

/* Task rows */
.opp-task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.opp-task-row:last-child { border-bottom: none; }
.opp-task-check { accent-color: var(--brand); width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }
.opp-task-title { flex: 1; color: var(--text-1); line-height: 1.4; }
.opp-task-title.done { text-decoration: line-through; color: var(--text-3); }
.opp-jurin-help-btn {
  font-size: 12px; padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--brand-mid); color: var(--brand);
  background: var(--brand-light); cursor: pointer; font-family: inherit;
}

/* ── Business sub-tabs ─────────────────────────────────────────────────────── */

#tab-business { padding: 0 !important; overflow: hidden; }

.biz-subtabs {
  display: flex; gap: 0; flex-shrink: 0;
  border-bottom: 1px solid var(--line-2);
  background: var(--bg);
  padding: 0 24px;
}
.biz-subtab {
  background: transparent; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-3);
  padding: 12px 16px; border-bottom: 2px solid transparent;
  transition: color var(--fast), border-color var(--fast);
  margin-bottom: -1px;
}
.biz-subtab:hover { color: var(--text-1); }
.biz-subtab.active { color: var(--brand); border-bottom-color: var(--brand); }

.biz-panel {
  display: none; flex: 1; min-height: 0;
  flex-direction: column; overflow-y: auto;
}
.biz-panel.active { display: flex; }

.biz-panel-header {
  display: flex; align-items: baseline;
  justify-content: space-between;
  padding: 24px 32px 0;
  flex-shrink: 0;
}
.biz-panel-h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.03em; color: var(--text-1); line-height: 1.1;
}
#biz-panel-info .biz-content { padding: 16px 32px 32px; }

/* ── Contracts layout ──────────────────────────────────────────────────────── */

#biz-panel-contracts { overflow: hidden; }

.ctr-layout {
  display: flex; flex: 1; min-height: 0; overflow: hidden; position: relative;
}
.ctr-sidebar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 240px;
  background: var(--bg-subtle); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 52;
  transform: translateX(0);
  box-shadow: 4px 0 24px rgba(0,0,0,.1);
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.22s;
}
.ctr-sidebar.collapsed {
  transform: translateX(-100%);
  box-shadow: none;
  pointer-events: none;
}
.ctr-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.ctr-sidebar-title { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.ctr-close-btn { display: flex; }
.ctr-main-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}
.ctr-toggle-btn { display: flex; }

.ctr-filters {
  display: flex; gap: 4px; padding: 8px 12px;
  flex-shrink: 0; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.ctr-filter {
  background: transparent; border: none; cursor: pointer;
  font-size: 11px; color: var(--text-3); padding: 4px 8px;
  border-radius: var(--radius-xs); transition: all var(--fast);
}
.ctr-filter:hover { color: var(--text-1); background: var(--bg-hover); }
.ctr-filter.active { color: var(--brand); background: var(--brand-light); font-weight: 600; }

.ctr-list { flex: 1; overflow-y: auto; }
.ctr-empty { color: var(--text-4); font-size: 13px; text-align: center; padding: 32px 16px; }

.ctr-item {
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background var(--fast);
}
.ctr-item:hover { background: var(--bg-hover); }
.ctr-item-selected { background: var(--brand-light) !important; }
.ctr-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.ctr-item-title { font-size: 13px; font-weight: 500; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ctr-item-badge { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 10px; flex-shrink: 0; }
.ctr-item-meta { font-size: 11px; color: var(--text-3); display: flex; gap: 4px; flex-wrap: wrap; }
.ctr-item-sep { color: var(--text-4); }

.ctr-main {
  flex: 1; display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
}
.ctr-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-3); font-size: 14px; text-align: center; gap: 12px;
}
.ctr-empty-icon { font-size: 40px; opacity: 0.4; }
.ctr-empty-state p { line-height: 1.6; }

.ctr-detail {
  flex-direction: column; gap: 0; padding: 24px 28px 32px;
  overflow-y: auto;
}
.ctr-detail-header { margin-bottom: 20px; }
.ctr-detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ctr-detail-title { font-size: 18px; font-weight: 700; color: var(--text-1); letter-spacing: -0.02em; flex: 1; }
.ctr-detail-title-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ctr-jurin-btn { font-size: 11px; padding: 2px 9px; height: 28px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--text-3); background: transparent; cursor: pointer; white-space: nowrap; transition: color var(--fast), border-color var(--fast); }
.ctr-jurin-btn:hover { color: var(--brand); border-color: var(--brand); }
.ctr-status-select {
  border: 1px solid var(--line-2); border-radius: var(--radius-xs);
  padding: 4px 8px; font-size: 12px; font-family: inherit;
  color: var(--text-2); background: var(--bg); cursor: pointer; flex-shrink: 0;
}
.ctr-meta-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ctr-meta-tag {
  font-size: 11px; color: var(--text-3); background: var(--bg-active);
  padding: 3px 8px; border-radius: 10px;
}

.ctr-detail-section { margin-bottom: 20px; }
.ctr-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 8px;
}
.ctr-summary { font-size: 13px; line-height: 1.7; color: var(--text-2); }
.ctr-terms { font-size: 13px; color: var(--text-2); padding-left: 16px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.ctr-notes-input {
  width: 100%; min-height: 80px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-xs);
  font-size: 13px; font-family: inherit; color: var(--text-1);
  background: var(--bg); resize: vertical; outline: none;
}
.ctr-notes-input:focus { border-color: var(--brand); }

.ctr-viewer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ctr-viewer { border: 1px solid var(--line-2); border-radius: var(--radius-xs); overflow: hidden; }
.ctr-viewer-embed { display: block; width: 100%; height: 480px; border: none; }
.ctr-viewer-img { display: block; max-width: 100%; height: auto; }
.ctr-viewer-placeholder { padding: 32px; text-align: center; color: var(--text-3); font-size: 13px; }

.ctr-detail-footer { padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.btn-danger {
  background: var(--rust-bg); color: var(--rust); border: 1px solid transparent;
  padding: 6px 12px; border-radius: var(--radius-xs); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--fast);
}
.btn-danger:hover { background: var(--rust); color: #fff; }

/* Upload modal */
.ctr-upload-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: var(--bg-overlay); display: flex;
  align-items: center; justify-content: center;
}
.ctr-upload-modal {
  background: var(--bg); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 24px;
  width: 440px; max-width: 90vw;
  box-shadow: 0 16px 48px rgba(0,0,0,0.12);
}
.ctr-upload-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.ctr-upload-header h3 { font-size: 16px; font-weight: 700; color: var(--text-1); margin: 0; }
.ctr-upload-close {
  background: transparent; border: none; color: var(--text-3);
  cursor: pointer; font-size: 16px; padding: 4px 8px;
  border-radius: var(--radius-xs);
}
.ctr-upload-close:hover { color: var(--text-1); background: var(--bg-hover); }
.ctr-drop-zone {
  border: 2px dashed var(--line-2); border-radius: var(--radius-xs);
  padding: 32px 24px; text-align: center; cursor: pointer;
  transition: border-color var(--fast), background var(--fast);
}
.ctr-drop-zone:hover, .ctr-drag-over { border-color: var(--brand); background: var(--brand-light); }
.ctr-drop-content { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ctr-drop-icon { font-size: 36px; }
.ctr-drop-text { font-size: 14px; font-weight: 500; color: var(--text-1); }
.ctr-drop-sub { font-size: 12px; color: var(--text-3); }
.ctr-uploading { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ctr-uploading-spinner {
  width: 28px; height: 28px; border: 2px solid var(--line-2);
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ctr-uploading-text { font-size: 13px; color: var(--text-2); }
.ctr-upload-error { margin-top: 12px; font-size: 13px; color: var(--rust); text-align: center; }

/* Mobile responsive */
@media (max-width: 640px) {
  .ctr-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 52;
    width: min(280px, 85vw); max-height: none;
    overflow: visible;
    border-right: 1px solid var(--line);
    transform: translateX(min(-280px, -85vw));
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0.28s;
    visibility: hidden; box-shadow: none;
  }
  .ctr-sidebar.mobile-open {
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0s;
    visibility: visible;
    box-shadow: 8px 0 32px rgba(0,0,0,.25);
  }
  .ctr-close-btn { display: flex !important; }
  .ctr-toggle-btn { display: flex !important; }
  .biz-panel-header { padding: 16px 16px 0; }
  #biz-panel-info .biz-content { padding: 12px 16px 24px; }
  .ctr-detail { padding: 16px 16px 24px; }
}

/* Thinking block — collapsible before assistant bubble */
.msg-row.assistant .thinking-block {
  margin-bottom: 8px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}
.msg-row.assistant .thinking-block summary {
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-3, #9ca3af);
  user-select: none;
  list-style: none;
}
.msg-row.assistant .thinking-block summary::-webkit-details-marker { display: none; }
.msg-row.assistant .thinking-block summary::before { content: '▸'; display: inline-block; margin-right: 6px; }
.msg-row.assistant .thinking-block[open] summary::before { content: '▾'; }
.msg-row.assistant .thinking-block .thinking-content {
  padding: 8px 10px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2, #6b7280);
  border-top: 1px solid var(--border, #e5e7eb);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

/* Live thinking preview during streaming */
.msg-thinking-preview {
  font-size: 12px;
  color: var(--text-3, #9ca3af);
  font-style: italic;
  padding: 4px 8px;
  margin-bottom: 4px;
  max-height: 60px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.7;
}
