/* base.css — reset, typography, global chrome (top nav, sidebar, main) */

/* ── RESET & BASE ───────────────────────────────────────────── */
*{box-sizing:border-box;margin:0;padding:0;}

body{font-family:'Inter',system-ui,-apple-system,sans-serif;font-size:13px;background:var(--bg);color:var(--text);min-height:100vh;}
a{color:var(--primary);text-decoration:none;cursor:pointer;}
a:hover{text-decoration:underline;color:var(--primary-dark);}
input,select,textarea{font-family:inherit;font-size:13px;}
button{font-family:inherit;font-size:13px;cursor:pointer;}

/* ── TOP NAV BAR ─────────────────────────────────────────────── */
/* v365.3: scroll the nav horizontally INSIDE the bar instead of letting
   the whole page get wider than the viewport. Solves the "content
   falling off the screen" symptom on narrow windows. */
.top-nav{
  background:#0f172a;
  border-bottom:1px solid #1e293b;
  padding:0 12px;
  height:var(--nav-height);
  display:flex;align-items:center;gap:2px;
  overflow-x:auto;
  overflow-y:hidden;
  white-space:nowrap;
}
.top-nav::-webkit-scrollbar{height:0;display:none;}
.nav-btn{
  background:transparent;
  border:none;
  border-radius:var(--radius-xs);
  padding:6px 12px;
  font-size:13px;
  font-weight:500;
  color:#94a3b8;
  cursor:pointer;
  white-space:nowrap;
  transition:background 0.15s,color 0.15s;
}
.nav-btn:hover{background:rgba(255,255,255,0.07);color:#e2e8f0;}
.nav-btn.active{
  background:var(--primary);
  color:#fff;
}
.nav-spacer{flex:1;}
.nav-user{font-size:13px;color:#64748b;padding:0 10px;}

/* v364: top-nav global search. Subtle dark-glass input that sits between
   the nav-spacer and the user / bell cluster, mirroring the redesign mock
   from /Users/rickyreyes/Downloads/new-crm-look/project/topnav.jsx. */
.topnav-search{
  display:inline-flex;align-items:center;gap:8px;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:6px;
  padding:5px 10px;
  margin-right:10px;
  min-width:260px;max-width:380px;
  transition:border-color 0.15s,background 0.15s;
  position:relative; /* v374.20: anchor for the typeahead dropdown */
}

/* v374.20: global typeahead dropdown.
   v374.20.1: position:fixed (was absolute) so the dropdown escapes the
   parent .top-nav { overflow-y:hidden } clip. JS computes top/left
   from the input's getBoundingClientRect() on every render. */
.topnav-search-results{
  position:fixed;
  top:0;left:0;
  background:#fff;
  border:1px solid #e2e8f0;
  border-radius:8px;
  box-shadow:0 12px 36px rgba(15,23,42,0.18);
  max-height:520px;
  overflow-y:auto;
  z-index:10000;
  padding:4px 0;
  display:none;
  min-width:380px;
  width:max-content;
  max-width:min(560px, calc(100vw - 40px));
}
.topnav-search-results.is-open{display:block;}
.tns-group-hd{
  padding:8px 14px 4px;
  font-size:9.5px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.08em;
  color:#94a3b8;
  background:#f8fafc;
  border-bottom:1px solid #e2e8f0;
}
.tns-row{
  display:flex;align-items:center;gap:10px;
  padding:8px 14px;
  font-size:12.5px;
  color:#0f172a;
  cursor:pointer;
  border:0;
  background:transparent;
  width:100%;
  text-align:left;
  font-family:inherit;
  transition:background 0.1s;
}
.tns-row:hover, .tns-row.is-active{background:#eff6ff;color:#1d4ed8;}
.tns-row .tns-icon{
  width:20px;height:20px;border-radius:5px;
  background:#eff6ff;color:#1d4ed8;
  display:inline-grid;place-items:center;
  font-size:11px;flex-shrink:0;
}
.tns-row.is-contact .tns-icon{background:#ecfdf5;color:#065f46;}
.tns-row.is-bc .tns-icon{background:#fef3c7;color:#92400e;}
.tns-row.is-deal .tns-icon{background:#dbeafe;color:#1d4ed8;}
.tns-row.is-deal.is-sub .tns-icon{background:#f1f5f9;color:#475569;}
.tns-row .tns-body{flex:1;min-width:0;}
.tns-row .tns-title{
  font-weight:600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tns-row .tns-sub{
  font-size:11px;color:#64748b;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tns-row.is-sub{
  padding-left:42px;
  background:#fafbfc;
  border-left:2px solid transparent;
}
.tns-row.is-sub:hover{
  border-left-color:#2563eb;
}
.tns-row .tns-pill{
  font-size:9.5px;font-weight:700;
  padding:1px 7px;border-radius:99px;
  background:#fef3c7;color:#92400e;
  text-transform:uppercase;letter-spacing:0.04em;
  margin-left:6px;flex-shrink:0;
}
.tns-empty{
  padding:18px 14px;
  text-align:center;
  font-size:12px;
  color:#94a3b8;
  font-style:italic;
}
.tns-footer{
  padding:6px 14px;
  font-size:10.5px;color:#94a3b8;
  border-top:1px solid #e2e8f0;
  display:flex;justify-content:space-between;
}
.tns-footer kbd{
  font-family:'SF Mono',Menlo,monospace;
  font-size:9.5px;
  background:#f1f5f9;
  border:1px solid #cbd5e1;
  border-radius:3px;
  padding:0 4px;
  color:#475569;
}
.topnav-search:focus-within{
  background:rgba(255,255,255,0.10);
  border-color:rgba(251,191,36,0.45);
}
.topnav-search-icon{font-size:12px;color:#94a3b8;line-height:1;}
.topnav-search input{
  flex:1;background:transparent;border:none;outline:none;
  color:#e2e8f0;font-size:12px;font-family:inherit;
  min-width:0;
}
.topnav-search input::placeholder{color:#64748b;}
.topnav-search .kbd{
  font-family:'SF Mono',Menlo,monospace;
  font-size:10px;color:#94a3b8;
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.10);
  border-radius:3px;padding:1px 5px;line-height:1;
}

/* v365.1: top-nav icon buttons (Bell, Sync). 30x30 grid-centered hit
   target with a hover glow that matches the Claude Design top-nav. */
.topnav-icon-btn{
  width:30px;height:30px;
  display:inline-grid;place-items:center;
  border-radius:6px;
  transition:background 0.15s,color 0.15s;
}
.topnav-icon-btn:hover{ background:rgba(255,255,255,0.06); }
.topnav-icon-btn:hover button,
.topnav-icon-btn:hover > svg{ color:#fff; }
.topnav-icon-btn > button{
  width:100%;height:100%;
  display:inline-flex;align-items:center;justify-content:center;
  background:transparent;border:none;cursor:pointer;
  border-radius:6px;
}

/* ── LAYOUT ──────────────────────────────────────────────────── */
/* v364: reserve a 60px gutter for the mini sidebar; the sidebar itself
   absolutely-positions inside that gutter so it can expand on hover
   without pushing the main content sideways. */
.app-wrap{display:flex;height:calc(100vh - var(--nav-height));position:relative;padding-left:64px;}

/* ── SIDEBAR (v364: mini-by-default, expand on hover · v365: sleek rail) ── */
/* 200 ms transition-delay on hover prevents accidental expansion when
   the cursor brushes the icon rail. Adding the `pinned` class (e.g. via
   a future pin button) holds the expanded state without hover. v365
   drops the duplicate ".sidebar-logo" + ".sidebar-welcome" blocks since
   the top-nav already owns branding + user identity. */
.sidebar{
  width:64px;
  background:var(--surface);
  border-right:1px solid var(--border);
  display:flex;flex-direction:column;
  overflow:hidden;
  position:absolute;
  top:0;left:0;bottom:0;
  z-index:50;
  /* Collapse: 60ms delay (brush-by tolerance), 150ms snappy ease-out.
     cubic-bezier(0.2,0,0,1) starts fast and decelerates — feels sharp. */
  transition:width 0.15s cubic-bezier(0.2,0,0,1) 0.06s;
  will-change:width;
  /* v365.3: inner padding gives symmetric breathing room. Everything
     inside the sidebar fills `width:100%` of the padded inner box so
     `place-items:center` truly centers content. */
  padding:8px 12px 0;
}
.sidebar:hover,
.sidebar.pinned{
  width:240px;
  padding:8px 10px 0;
  box-shadow:6px 0 18px rgba(15,23,42,0.12);
  transition-delay:0s;
}
/* Hide the legacy logo + welcome blocks entirely — the top-nav has the
   brand mark and the user-facing controls now live in the top-nav user
   dropdown (Sign Out, etc.). The legacy IDs inside .sidebar-welcome are
   kept off-screen via the `hidden` attribute so existing JS that pokes
   them still resolves. */
.sidebar .sidebar-logo,
.sidebar .sidebar-welcome{ display:none !important; }

/* Block-level sidebar rows — opacity only. The sidebar's overflow:hidden
   clips them at the current width; no max-width animation needed. */
.sidebar .search-box,
.sidebar .adv-search,
.sidebar #sidebarCount,
.sidebar .sidebar-footer{
  opacity:0;
  overflow:hidden;
  white-space:nowrap;
  pointer-events:none;
  transition:opacity 0.10s ease-out;
}
/* Inline labels that sit alongside an icon — must collapse to zero width
   so the icon stays centered in the collapsed rail. */
.sidebar .sb-tab-label,
.sidebar .add-new-label{
  opacity:0;
  max-width:0;
  overflow:hidden;
  white-space:nowrap;
  pointer-events:none;
  transition:opacity 0.10s ease-out, max-width 0.13s cubic-bezier(0.2,0,0,1);
}
.sidebar .recent-name,
.sidebar .recent-id{
  display:none;
}
/* Expanded state — block rows */
.sidebar:hover .search-box,
.sidebar.pinned .search-box,
.sidebar:hover .adv-search,
.sidebar.pinned .adv-search,
.sidebar:hover #sidebarCount,
.sidebar.pinned #sidebarCount,
.sidebar:hover .sidebar-footer,
.sidebar.pinned .sidebar-footer{
  opacity:1;
  pointer-events:auto;
  transition:opacity 0.14s ease-out 0.05s;
}
/* Expanded state — inline icon labels */
.sidebar:hover .sb-tab-label,
.sidebar.pinned .sb-tab-label,
.sidebar:hover .add-new-label,
.sidebar.pinned .add-new-label{
  opacity:1;
  max-width:200px;
  pointer-events:auto;
  transition:opacity 0.14s ease-out 0.05s, max-width 0.13s cubic-bezier(0.2,0,0,1);
}
.sidebar:hover .recent-name,
.sidebar.pinned .recent-name,
.sidebar:hover .recent-id,
.sidebar.pinned .recent-id{display:inline;}

/* .search-box needs to be flex when revealed (input + ⌘/ badge) */
.sidebar:hover .search-box,
.sidebar.pinned .search-box{display:flex;}
.sidebar .search-box{display:flex;}

/* .adv-search needs flex-end layout for the right-aligned Find Duplicates link */
.sidebar .adv-search{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:10px;
}
.sidebar .adv-search a{
  font-size:11px;
  color:#64748b;
  cursor:pointer;
  white-space:nowrap;
}
.sidebar .adv-search a:hover{color:var(--primary);}
/* When collapsed, the recent-list rows show only a status dot. */
.sidebar:not(:hover):not(.pinned) .recent-item{
  justify-content:center;
  padding:8px 0;
}
.sidebar:not(:hover):not(.pinned) .dial-dot{
  margin-right:0;
}
/* v299: sidebar logo — kill the gradient per the redesign brief, use
   solid Bloomberg-black slate; gold accent on the lead "A" matches the
   top-nav .ds-brand accent. */
.sidebar-logo{
  background:#0f172a;
  padding:16px 14px 12px;
  text-align:center;
  border-bottom:1px solid #1e293b;
}
.sidebar-logo .logo-text{
  font-size:26px;font-weight:800;color:#fff;
  font-style:italic;letter-spacing:-0.5px;
}
.sidebar-logo .logo-text span{color:#fbbf24;}
.sidebar-logo .logo-sub{
  font-size:9px;color:#94a3b8;letter-spacing:2.5px;margin-top:3px;font-weight:600;text-transform:uppercase;
}
.sidebar-welcome{
  background:var(--primary-light);
  border-bottom:1px solid var(--border);
  padding:8px 12px;
  font-size:12px;
  color:var(--text2);
}
.sidebar-welcome strong{color:var(--primary-dark);font-weight:600;}

/* v365.3: Add New Deal button — full-width inside a padded container,
   `place-items:center` puts the "+" dead-center horizontally regardless
   of the sidebar's current state. The container's padding (set on
   .sidebar itself, see below) gives us symmetric breathing room on both
   sides of the rail. */
.add-new-btn{
  position:relative;
  display:grid;place-items:center;
  width:38px;height:38px;
  margin:0 auto;
  background:var(--primary);
  border:none;border-radius:8px;
  color:#fff;font-weight:600;font-size:13px;
  box-shadow:0 1px 2px rgba(15,23,42,0.08);
  cursor:pointer;
  overflow:hidden;
  transition:background 0.15s,width 0.18s cubic-bezier(0.2,0,0,1) 0.25s;
}
.sidebar:hover .add-new-btn,
.sidebar.pinned .add-new-btn{
  width:100%;
  transition-delay:0.08s;
}
.add-new-btn::before{
  content:"+";
  font-size:22px;font-weight:300;line-height:1;color:#fff;
  font-family:-apple-system,BlinkMacSystemFont,'Inter',system-ui,sans-serif;
  pointer-events:none;
}
.sidebar:hover .add-new-btn::before,
.sidebar.pinned .add-new-btn::before{
  position:absolute;left:14px;
}
.add-new-btn:hover{background:var(--primary-dark);}
.add-new-label{white-space:nowrap;line-height:1;}

/* v365.3: sidebar view tabs. Mini mode → full-width 36px-tall squares
   that fill the padded inner column, with the SVG centered via
   place-items:center so it sits dead-center in the rail. Expanded
   mode → icon + label aligned left, padding gives breathing room. */
.sb-view-tabs{
  display:flex;flex-direction:column;
  gap:2px;
  padding:4px 0 0;
}
.sb-view-tabs > button{
  display:grid;place-items:center;
  width:100%;height:36px;
  background:transparent;border:none;
  border-radius:6px;
  color:var(--text2);cursor:pointer;
  font-size:12px;font-weight:500;
  position:relative;
  transition:background 0.12s,color 0.12s;
}
.sb-view-tabs > button:hover{background:var(--primary-light);color:var(--primary);}
.sb-view-tabs > button.active{
  background:var(--primary-light);color:var(--primary);font-weight:600;
}
.sb-view-tabs svg{flex-shrink:0;display:block;}
.sb-view-tabs .sb-tab-label{margin-left:10px;}
.sidebar:hover .sb-view-tabs > button,
.sidebar.pinned .sb-view-tabs > button{
  grid-template-columns:auto 1fr;
  justify-content:flex-start;
  padding:0 12px;
  gap:0;
}

/* v365: the inline sideSearch kbd badge — mirrors the topnav .kbd styling
   so the sidebar search and the topnav search both show the shortcut hint. */
.sidebar .search-box .kbd{
  font-family:'SF Mono',Menlo,monospace;
  font-size:10px;color:var(--text3);
  background:var(--surface2);
  border:1px solid var(--border);
  border-radius:3px;padding:1px 5px;line-height:1;
  flex-shrink:0;
}

.search-box{
  margin:0 10px 8px;
  display:flex;gap:4px;align-items:center;
}
.search-box input{
  flex:1;border:1px solid var(--border);border-radius:var(--radius-xs);padding:6px 8px;
  background:var(--surface2);font-size:12px;color:var(--text);transition:border 0.15s;
}
.search-box input:focus{outline:none;border-color:var(--primary);}
.search-box button{
  background:var(--surface2);
  border:1px solid var(--border);border-radius:var(--radius-xs);padding:5px 8px;color:var(--text2);
  transition:background 0.15s;
}
.search-box button:hover{background:var(--border);}
.adv-search{text-align:center;font-size:11px;margin-bottom:8px;color:var(--text3);}

.sidebar-section-title{
  background:var(--surface2);
  color:var(--text2);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:0.06em;
  padding:6px 12px;
  border-top:1px solid var(--border);border-bottom:1px solid var(--border);
}
.recent-list{overflow-y:auto;flex:1;}
.recent-item{
  display:flex;align-items:center;
  padding:7px 10px;
  border-bottom:1px solid var(--border);
  cursor:pointer;
  background:var(--surface);
  transition:background 0.1s;
}
.recent-item:hover{background:var(--primary-light);}
.recent-item.active{background:var(--primary-light);border-left:3px solid var(--primary);}
.dial-dot{
  width:8px;height:8px;border-radius:50%;
  background:var(--green);
  flex-shrink:0;margin-right:8px;
}
.recent-name{font-size:12px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;}
.recent-id{font-size:10px;color:var(--text3);margin-left:auto;flex-shrink:0;font-weight:600;background:var(--bg);padding:1px 5px;border-radius:3px;}

.sidebar-footer{
  padding:8px 12px;font-size:10px;color:var(--text3);
  border-top:1px solid var(--border);background:var(--surface2);
  line-height:1.6;
}

/* ── MAIN CONTENT ────────────────────────────────────────────── */
.main{flex:1;overflow:auto;display:flex;flex-direction:column;background:var(--bg);}

/* LOADING / EMPTY */
.center-msg{
  flex:1;display:flex;align-items:center;justify-content:center;
  flex-direction:column;gap:12px;
  color:var(--text2);font-size:14px;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media(max-width:700px){
  .sidebar{width:170px;}
  .two-pane{grid-template-columns:1fr;}
  .deal-info-grid{grid-template-columns:1fr;}
  .deal-actions{flex-direction:column;}
}
