/* Equiturn OS — Deal Command Interface
   Screen-only visual system. It does not style generated documents or exports. */
@media screen {
  :root {
    --navy: #101747;
    --navy-light: #1d286b;
    --off-white: #f3f5fb;
    --white: #ffffff;
    --border: #e2e7f1;
    --border-light: #edf0f6;
    --text: #18213b;
    --text-bright: #101a35;
    --text-dim: #65708a;
    --accent-blue: #506cf4;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 7px;
    --shadow-xs: 0 1px 2px rgba(20,31,66,.05);
    --shadow-sm: 0 3px 10px rgba(19,30,64,.055), 0 1px 2px rgba(19,30,64,.035);
    --shadow: 0 10px 24px rgba(19,30,64,.075), 0 2px 5px rgba(19,30,64,.035);
    --shadow-md: 0 18px 42px rgba(19,30,64,.10), 0 5px 12px rgba(19,30,64,.045);
    --shadow-hover: 0 22px 46px rgba(19,30,64,.13), 0 7px 16px rgba(19,30,64,.06);
    --sidebar-width: 236px;
  }

  body {
    background:
      radial-gradient(circle at 85% -10%, rgba(99,120,245,.11), transparent 30%),
      radial-gradient(circle at 15% 100%, rgba(145,157,216,.09), transparent 28%),
      var(--off-white);
  }

  /* One authoritative sidebar/workspace boundary: cards never sit beneath navigation. */
  @media (min-width: 1025px) {
    .sidebar { width: var(--sidebar-width) !important; }
    .main-content {
      margin-left: var(--sidebar-width) !important;
      width: calc(100% - var(--sidebar-width));
      min-width: 0;
      overflow-x: hidden;
    }
    .view { min-width: 0; }
  }
  @media (max-width: 1024px) {
    .main-content { margin-left: 0 !important; width: 100%; min-width: 0; overflow-x: hidden; }
    .sidebar { width: 260px; }
    .dash-intel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-intel-body { grid-template-columns: minmax(0, 1fr); }
  }

  /* Navigation: quiet, precise, and distinctly product-grade. */
  .sidebar {
    background: linear-gradient(180deg, #101747 0%, #0b1033 100%);
    border-right: 1px solid rgba(255,255,255,.09);
    box-shadow: 10px 0 32px rgba(8,12,40,.10);
  }
  .sidebar-brand { padding: 20px 15px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
  .sidebar-brand .brand-lockup img { width: 142px; }
  .nav-item {
    margin: 3px 8px;
    padding: 7px 10px;
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    min-height: 37px;
    transition: background .18s var(--ease-out), border-color .18s var(--ease-out), transform .18s var(--ease-out);
  }
  .nav-item:hover { background: rgba(255,255,255,.075); transform: translateX(2px); }
  .nav-item.active { background: linear-gradient(90deg, rgba(110,130,255,.24), rgba(110,130,255,.09)); border-color: rgba(149,164,255,.16); }
  .nav-item .nav-icon { flex: 0 0 15px; }
  .nav-item { white-space: nowrap; overflow: visible; }

  /* A command bar, not a row of disconnected controls. */
  .pipeline-header, .dealroom-header {
    margin: 18px 22px 12px;
    padding: 14px 16px;
    border: 1px solid rgba(222,227,240,.98);
    border-radius: 14px;
    background: rgba(255,255,255,.84);
    box-shadow: 0 5px 16px rgba(18,28,60,.045), inset 0 1px 0 rgba(255,255,255,.9);
    backdrop-filter: blur(16px);
  }
  .pipeline-header h2, .dealroom-title h2 {
    color: var(--text-bright);
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -.025em;
    text-transform: none;
  }
  .pipeline-controls, .dealroom-actions, .generation-actions, .team-actions-bar, .briefing-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Deal-header actions are a compact command toolbar, not oversized cards. */
  .dealroom-actions {
    gap: 5px;
    padding: 5px;
    border: 1px solid #e2e6ef;
    border-radius: 12px;
    background: #f7f8fc;
    box-shadow: inset 0 1px 1px rgba(18,28,60,.03);
  }
  .dealroom-actions .btn-action,
  .dealroom-actions .btn-small,
  .dealroom-actions .btn-secondary,
  .dealroom-actions .btn-danger-outline,
  .dealroom-actions .btn-warroom {
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #34405c;
    box-shadow: none;
    font-size: 11px;
    font-weight: 650;
  }
  .dealroom-actions .btn-action:hover,
  .dealroom-actions .btn-small:hover,
  .dealroom-actions .btn-secondary:hover,
  .dealroom-actions .btn-warroom:hover {
    transform: none;
    background: #fff;
    border-color: #d8deeb;
    box-shadow: 0 2px 5px rgba(18,28,60,.06);
  }
  .dealroom-actions .btn-warroom { color: #c63b30; }
  .dealroom-actions .btn-warroom:hover { background: #fff3f1; border-color: #f0c9c3; }
  .dealroom-actions .btn-danger-outline { color: #b7352d; }
  .dealroom-actions .btn-danger-outline:hover { background: #fff2f1; border-color: #efc3bf; }

  /* Buttons deliberately have three visual levels. */
  button, .btn-primary, .btn-secondary, .btn-small, .btn-action, .btn-accent,
  .btn-danger, .btn-danger-outline, .btn-warroom, .btn-briefing {
    min-height: 36px;
    padding: 7px 13px;
    border-radius: 9px;
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .005em;
    transition: transform .17s var(--ease-out), box-shadow .17s var(--ease-out), background .17s var(--ease-out), border-color .17s var(--ease-out);
  }
  .btn-primary, .btn-accent, .btn-briefing {
    background: linear-gradient(135deg, #1c286d, #101747 66%);
    color: #fff;
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 5px 12px rgba(16,23,71,.24), inset 0 1px 0 rgba(255,255,255,.16);
  }
  .btn-secondary, .btn-small, .btn-action, .btn-danger-outline {
    background: linear-gradient(180deg, #fff, #fafbfe);
    color: #27304a;
    border: 1px solid #dce2ef;
    box-shadow: 0 2px 4px rgba(18,28,60,.035), inset 0 1px 0 #fff;
  }
  .btn-action.accent { background: #eef1ff; color: #3347bb; border-color: #dce2ff; box-shadow: none; }
  button:not(:disabled):hover, .btn-primary:not(:disabled):hover, .btn-secondary:not(:disabled):hover,
  .btn-small:not(:disabled):hover, .btn-action:not(:disabled):hover, .btn-accent:not(:disabled):hover,
  .btn-danger:not(:disabled):hover, .btn-danger-outline:not(:disabled):hover, .btn-warroom:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(18,28,60,.13);
  }
  button:not(:disabled):active { transform: translateY(0); box-shadow: inset 0 2px 5px rgba(15,23,65,.14); }

  /* Search, forms, and dropdowns get a calmer high-end treatment. */
  input[type="text"], input[type="email"], input[type="password"], input[type="search"],
  input[type="number"], input[type="date"], textarea, select, .pipeline-search {
    min-height: 40px;
    border: 1px solid #dce2ee;
    border-radius: 9px;
    padding: 9px 12px;
    background: rgba(255,255,255,.96);
    color: #18213b;
    box-shadow: inset 0 1px 2px rgba(18,28,60,.025), 0 1px 1px rgba(18,28,60,.02);
    transition: border-color .17s var(--ease-out), box-shadow .17s var(--ease-out), background .17s var(--ease-out);
  }
  input:focus, textarea:focus, select:focus {
    border-color: #7c91ff;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(80,108,244,.12), 0 6px 13px rgba(18,28,60,.06);
  }

  /* Data surfaces: dimensional without turning every panel into a balloon. */
  .deal-card, .overview-card, .dash-metric-card, .specialist-panel, .unified-panel,
  .analytics-panel, .comparison-panel, .agent-output-content, .modal-card, .modal,
  .modal-box, .docs-upload-zone, .investor-table-wrap, .vdr-container, .inbox-container {
    border: 1px solid rgba(222,227,240,.98);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(249,250,255,.96));
    box-shadow: var(--shadow-sm);
  }
  .deal-card, .dash-metric-card { overflow: hidden; }
  /* Overview cards contain live deal controls; never clip their contents. */
  .overview-card { overflow: visible; }
  .deal-card:hover, .overview-card:hover, .dash-metric-card:hover {
    transform: translateY(-3px);
    border-color: #d1daf5;
    box-shadow: var(--shadow-hover);
  }
  .dash-metric-card { padding: 22px 18px; position: relative; overflow: hidden; }
  .dash-metric-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #101747, var(--accent-blue)); opacity: 0.7;
  }
  .dash-metric-label { color: #74809b; font-weight: 650; letter-spacing: .055em; font-size: 10px; }
  .dash-metric-value { color: #131c43; font-size: 28px; font-weight: 800; letter-spacing: -.04em; margin-top: 6px; }
  .dash-intel-section { padding: 20px; }
  .dash-intel-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: #536078; }
  .dash-stage-bar { background: linear-gradient(180deg, rgba(80,108,244,0.16), rgba(80,108,244,0.06)); border-radius: 6px 6px 0 0; }
  .dash-intel-body { gap: 16px; }
  .dash-intel-col { gap: 16px; }
  .dash-intel-grid { gap: 14px; margin-bottom: 20px; }
  .dash-workload-fill { background: linear-gradient(90deg, var(--accent-blue), #22c55e); }

  /* The stage rail must share the available width rather than expand for labels. */
  .stage-progress { width: 100%; gap: 6px; }
  .stage-progress > div { flex: 1 1 0; min-width: 0; }
  .stage-step { width: 100%; min-width: 0; }
  .stage-label {
    min-width: 0;
    font-size: clamp(8px, .82vw, 11px);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Tabs behave as an intentional navigation rail. */
  .dr-tabs {
    margin: 0 22px 14px;
    padding: 5px;
    border: 1px solid #e0e5ef;
    border-radius: 12px;
    background: rgba(255,255,255,.80);
    box-shadow: 0 3px 9px rgba(18,28,60,.035);
  }
  .dr-tab {
    min-height: 34px;
    padding: 7px 11px;
    border: 0;
    border-radius: 8px;
    color: #66718b;
    background: transparent;
  }
  .dr-tab:hover { background: #f1f3fb; color: #273354; box-shadow: none; transform: none; }
  .dr-tab.active { color: #172365; background: #e8edff; box-shadow: inset 0 0 0 1px #d8e0ff; }

  /* Chats are a real workspace: an elevated transcript and composed input dock. */
  .chat-container, .investors-chat {
    border: 1px solid #dde3ef;
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .chat-messages { padding: 20px; background: linear-gradient(180deg, #f8f9fd 0, #fff 30%); }
  .chat-msg { margin: 0 0 13px; padding: 10px 11px; border: 1px solid transparent; border-radius: 11px; }
  .chat-msg:hover { background: rgba(80,108,244,.042); border-color: rgba(80,108,244,.09); }
  .chat-avatar { width: 33px; height: 33px; border-radius: 10px; box-shadow: 0 4px 9px rgba(18,28,60,.12); }
  .chat-text { font-size: 13px; line-height: 1.62; color: #33405b; }
  .chat-input-bar {
    gap: 10px;
    padding: 13px;
    border-top: 1px solid #e6e9f2;
    background: #fafbfe;
  }
  .chat-input-bar textarea { min-height: 46px; margin: 0; border-radius: 10px; background: #fff; }
  .chat-input-bar .btn-primary { min-height: 44px; padding: 0 16px; }

  /* Tables, modals and review panels. */
  table { border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid #e2e6ef; border-radius: 11px; }
  th { background: #f5f7fc !important; color: #536078 !important; font-size: 11px; font-weight: 700; letter-spacing: .035em; }
  td { border-color: #edf0f5 !important; }
  .modal-overlay { backdrop-filter: blur(9px); background: rgba(8,12,40,.34); }
  .modal, .modal-card, .modal-box { box-shadow: 0 28px 72px rgba(8,12,40,.24); }
  .agent-output-content { padding: 20px; }

  @media (max-width: 900px) {
    :root { --sidebar-width: 210px; }
    .pipeline-header, .dealroom-header, .dr-tabs { margin-left: 12px; margin-right: 12px; }
    .pipeline-header, .dealroom-header { padding: 12px; }
  }

  @media (max-width: 768px) {
    .pipeline-header, .dealroom-header { margin: 8px 10px; padding: 10px 12px; }
    .dr-tabs { margin: 0 10px 10px; }
    .dealroom-actions {
      overflow-x: auto;
      flex-wrap: nowrap;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
      padding: 4px;
    }
    .dealroom-actions::-webkit-scrollbar { display: none; }
    .dealroom-actions .btn-action,
    .dealroom-actions .btn-small,
    .dealroom-actions .btn-secondary,
    .dealroom-actions .btn-danger-outline,
    .dealroom-actions .btn-warroom { white-space: nowrap; flex-shrink: 0; }
  }

  @media (max-width: 480px) {
    .pipeline-header, .dealroom-header { margin: 6px 8px; padding: 8px 10px; border-radius: 10px; }
    .pipeline-header h2, .dealroom-title h2 { font-size: 15px; }
    .dr-tabs { margin: 0 8px 8px; padding: 3px; border-radius: 9px; }
    .dr-tab { min-height: 30px; padding: 5px 8px; font-size: 11px; }
    button, .btn-primary, .btn-secondary, .btn-small, .btn-action { font-size: 11px; }
  }

  /* Touch device: disable hover lift */
  @media (hover: none) and (pointer: coarse) {
    .deal-card:hover, .overview-card:hover, .dash-metric-card:hover { transform: none; }
    button:not(:disabled):hover, .btn-primary:not(:disabled):hover,
    .btn-secondary:not(:disabled):hover, .btn-small:not(:disabled):hover,
    .btn-action:not(:disabled):hover { transform: none; box-shadow: var(--shadow-sm); }
    .nav-item:hover { transform: none; }
  }

  /* Reflow dashboards before the working area becomes cramped beside navigation. */
  @media (max-width: 1400px) {
    .dash-intel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-intel-body { grid-template-columns: minmax(0, 1fr); }
    .pipeline-header, .dealroom-header { margin-left: 16px; margin-right: 16px; }
  }
}

/* Keep the sign-in action full width and visually primary. */
#view-login .login-form .btn-full {
  display: flex;
  width: 100% !important;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
}
