/* app/assets/stylesheets/imports.css
   =========================================================
   CandlEntry · Import Center
   Narrow scope: connect a brokerage, or upload a CSV.
   ========================================================= */

   .import-page {
    --i-surface:      #ffffff;
    --i-surface-2:    #f8fafc;
    --i-surface-3:    #f1f5f9;
    --i-border:       #e5e7eb;
    --i-border-soft:  #f1f5f9;
    --i-text-1:       #0f172a;
    --i-text-2:       #475569;
    --i-text-3:       #94a3b8;
    --i-accent:       #2563eb;
    --i-accent-strong:#1d4ed8;
    --i-accent-soft:  #eff6ff;
    --i-accent-border:#bfdbfe;
    --i-profit:       #059669;
    --i-mono:         ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
    --i-shadow:       0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --i-shadow-lift:  0 12px 24px -12px rgba(15, 23, 42, .18);
    --i-ease:         cubic-bezier(0.16, 1, 0.3, 1);
  
    max-width: 940px;
    margin: 0 auto;
    padding: 28px 24px 56px;
    -webkit-font-smoothing: antialiased;
    color: var(--i-text-1);
  }
  
  /* =========================================================
     HEADER
     ========================================================= */
  .import-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  .import-head h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.15;
  }
  .import-head p {
    margin: 4px 0 0;
    font-size: 13.5px;
    color: var(--i-text-2);
    font-weight: 500;
  }
  .import-head-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--i-text-2);
    text-decoration: none;
    box-shadow: var(--i-shadow);
    transition: color .15s, border-color .15s;
  }
  .import-head-link strong {
    color: var(--i-text-1);
    font-weight: 800;
  }
  .import-head-link:hover {
    color: var(--i-text-1);
    border-color: #cbd5e1;
  }
  
  /* =========================================================
     PATH SELECTOR — the fork in the road
     ========================================================= */
  .path-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }
  
  .path-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: 14px;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s, transform .1s;
    min-width: 0;
  }
  .path-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--i-shadow-lift);
    transform: translateY(-1px);
  }
  .path-card.is-active {
    border-color: var(--i-accent);
    background: linear-gradient(180deg, var(--i-accent-soft) 0%, #ffffff 45%);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1), var(--i-shadow);
  }
  
  .path-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }
  
  .path-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, color .15s;
  }
  .path-icon--connect { background: var(--i-accent-soft); color: var(--i-accent); }
  .path-card.is-active .path-icon--connect { background: var(--i-accent); color: #fff; }
  .path-icon--upload { background: var(--i-surface-3); color: var(--i-text-2); }
  .path-card.is-active .path-icon--upload { background: var(--i-text-1); color: #fff; }
  
  .path-badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--i-accent-soft);
    color: var(--i-accent-strong);
    border: 1px solid var(--i-accent-border);
  }
  
  .path-card h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--i-text-1);
  }
  .path-card p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--i-text-2);
    font-weight: 500;
  }
  
  /* =========================================================
     PANELS
     ========================================================= */
  .panel { display: none; }
  .panel.is-active {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: importFade .22s var(--i-ease);
  }
  @keyframes importFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  
  /* =========================================================
     SHARED CARD
     ========================================================= */
  .i-card {
    background: var(--i-surface);
    border: 1px solid var(--i-border);
    border-radius: 14px;
    box-shadow: var(--i-shadow);
    padding: 20px;
  }
  
  /* =========================================================
     CONNECT — SnapTrade banner
     ========================================================= */
  .snaptrade-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--i-accent-soft) 0%, #ffffff 62%);
    border: 1px solid var(--i-accent-border);
    border-radius: 14px;
    box-shadow: var(--i-shadow);
    flex-wrap: wrap;
  }
  
  .snaptrade-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
  }
  .snaptrade-mark {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 11px;
    background: var(--i-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px -8px rgba(37, 99, 235, .55);
  }
  .snaptrade-left h3 {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.005em;
    color: var(--i-text-1);
  }
  .snaptrade-left p {
    margin: 0;
    font-size: 12.5px;
    color: var(--i-text-2);
    line-height: 1.5;
    font-weight: 500;
  }
  
  /* =========================================================
     LINKED ACCOUNTS
     ========================================================= */
  .linked-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }
  .linked-head h3 {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--i-text-3);
  }
  .linked-count {
    font-family: var(--i-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--i-text-3);
  }
  
  .linked-list {
    display: flex;
    flex-direction: column;
  }
  .linked-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--i-border-soft);
  }
  .linked-row:first-child { padding-top: 0; }
  .linked-row:last-child  { padding-bottom: 0; border-bottom: 0; }
  
  .linked-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    padding: 0 3px;
  }
  
  .linked-info {
    flex: 1;
    min-width: 0;
  }
  .linked-info strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--i-text-1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .linked-info span {
    display: block;
    font-size: 11.5px;
    color: var(--i-text-3);
    margin-top: 1px;
    font-weight: 500;
  }
  
  .linked-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .linked-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--i-surface-2);
    border: 1px solid var(--i-border-soft);
    font-family: var(--i-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--i-text-2);
    white-space: nowrap;
  }
  .linked-pill.is-active {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: var(--i-profit);
  }
  .linked-pill .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
  }
  
  /* =========================================================
   BROKER ACCORDION
   ========================================================= */
.check-hint {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--i-text-3);
  letter-spacing: 0.01em;
}

.broker-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--i-surface-2);
  border: 1px solid var(--i-border);
  border-radius: 10px;
  color: var(--i-text-3);
  margin-bottom: 10px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.broker-search:focus-within {
  background: #fff;
  border-color: var(--i-accent-border);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.broker-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--i-text-1);
}
.broker-search input::placeholder { color: var(--i-text-3); }

.accordion {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--i-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--i-surface);
}

.acc-item {
  border-bottom: 1px solid var(--i-border-soft);
}
.acc-item:last-child { border-bottom: 0; }

.acc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--i-text-1);
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.acc-head:hover { background: var(--i-surface-2); }
.acc-item.is-open > .acc-head { background: var(--i-surface-2); }

.acc-flag {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}
.acc-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acc-count {
  font-family: var(--i-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--i-text-3);
  padding: 2px 7px;
  background: var(--i-surface-3);
  border-radius: 999px;
}
.acc-chevron {
  flex-shrink: 0;
  color: var(--i-text-3);
  transition: transform .2s var(--i-ease);
}
.acc-item.is-open .acc-chevron { transform: rotate(180deg); }

.acc-body {
  display: none;
  padding: 4px 14px 14px;
  background: var(--i-surface);
}
.acc-item.is-open > .acc-body {
  display: block;
  animation: importFade .2s var(--i-ease);
}

.acc-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
}

.broker-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 6px;
  background: var(--i-surface);
  border: 1px solid var(--i-border);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--i-text-1);
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.broker-chip:hover {
  background: var(--i-surface-2);
  border-color: #cbd5e1;
}
.broker-chip.is-hidden { display: none; }

.broker-logo {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: -0.02em;
  padding: 0 2px;
}

.broker-empty {
  display: none;
  padding: 12px 4px 4px;
  font-size: 12.5px;
  color: var(--i-text-3);
  font-weight: 500;
  text-align: center;
}
.broker-empty.is-visible { display: block; }

  
  /* =========================================================
     UPLOAD
     ========================================================= */
  .upload-note {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--i-surface-2);
    border: 1px solid var(--i-border-soft);
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 12.5px;
    color: var(--i-text-2);
    font-weight: 500;
    line-height: 1.45;
  }
  .upload-note svg {
    flex-shrink: 0;
    color: var(--i-accent);
  }
  
  .dropzone {
    display: block;
    padding: 32px 20px;
    background: var(--i-surface-2);
    border: 2px dashed var(--i-border);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
  }
  .dropzone:hover,
  .dropzone.is-dragover {
    border-color: var(--i-accent);
    background: var(--i-accent-soft);
  }
  
  .dropzone-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    border-radius: 11px;
    background: white;
    border: 1px solid var(--i-border);
    color: var(--i-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s;
  }
  .dropzone:hover .dropzone-icon { transform: translateY(-2px); }
  
  .dropzone strong {
    display: block;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--i-text-1);
    margin-bottom: 2px;
  }
  .dropzone span {
    display: block;
    font-size: 12px;
    color: var(--i-text-2);
    font-weight: 500;
  }
  
  .file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 5px 8px 5px 12px;
    background: white;
    border: 1px solid var(--i-accent-border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--i-accent);
  }
  .file-chip button {
    border: 0;
    background: transparent;
    color: var(--i-accent);
    opacity: .7;
    font-size: 13px;
    cursor: pointer;
    padding: 0 3px;
    line-height: 1;
  }
  .file-chip button:hover { opacity: 1; }
  
  .upload-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
  }
  .field {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .field label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--i-text-3);
  }
  .field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--i-border);
    border-radius: 9px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--i-text-1);
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
  }
  .field select:focus {
    outline: 0;
    border-color: var(--i-accent-border);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
  }
  
  .upload-toggles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
  }
  
  .toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--i-surface-2);
    border: 1px solid var(--i-border-soft);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
  }
  .toggle-row:hover {
    background: #fff;
    border-color: var(--i-border);
  }
  .toggle-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--i-accent);
  }
  .toggle-row strong {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--i-text-1);
  }
  .toggle-row span {
    display: block;
    font-size: 11px;
    color: var(--i-text-3);
    margin-top: 1px;
    line-height: 1.4;
    font-weight: 500;
  }
  
  /* =========================================================
     BUTTONS
     ========================================================= */
  .i-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s, transform .1s, box-shadow .15s;
  }
  .i-btn:active { transform: translateY(1px); }
  .i-btn:focus-visible { outline: 2px solid var(--i-accent); outline-offset: 2px; }
  
  .i-btn--primary {
    background: var(--i-accent);
    color: #fff;
    box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .5);
  }
  .i-btn--primary:hover:not(:disabled) {
    background: var(--i-accent-strong);
    color: #fff;
    box-shadow: 0 6px 16px -4px rgba(37, 99, 235, .6);
  }
  .i-btn--primary:disabled {
    background: var(--i-border);
    color: var(--i-text-3);
    cursor: not-allowed;
    box-shadow: none;
  }
  .i-btn--full { width: 100%; margin-top: 16px; }
  
  .i-btn .i-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: importSpin .7s linear infinite;
  }
  .i-btn.is-loading .i-spinner { display: inline-block; }
  .i-btn.is-loading .i-btn-label { display: none; }



  /* ============================================================
  CSV IMPORT
  ============================================================ */
  .trades-table td select, .trades-table th select {
    width: 100%;
    min-width: 170px;
    padding: 8px 12px;
    background: var(--t-surface-2);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--t-text-1);
    outline: none;
    appearance: none;
  }
  .trades-table td select:focus { border-color: var(--t-accent-border); background: #fff; }
  .trades-table th.is-mapped-col { color: var(--t-accent); }
  .trades-table th.is-mapped-col::after { content: " · mapped"; font-size: 9.5px; font-weight: 700; opacity: .8; }
  .csv-map .hint-cell { color: var(--t-text-3); font-size: 12px; white-space: normal; }
  .csv-check {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600; color: var(--t-text-2);
    margin: 0 22px 8px 0;
  }
  .csv-check input { width: 15px; height: 15px; accent-color: var(--t-accent); }


  
  @keyframes importSpin { to { transform: rotate(360deg); } }
  
  /* =========================================================
     RESPONSIVE
     ========================================================= */
  @media (max-width: 760px) {
    .import-page { padding: 20px 16px 48px; }
    .import-head h1 { font-size: 20px; }
    .path-grid      { grid-template-columns: 1fr; }
    .upload-fields  { grid-template-columns: 1fr; }
    .upload-toggles { grid-template-columns: 1fr; }
    .snaptrade-card { padding: 14px; }
    .snaptrade-left { gap: 10px; }
    .snaptrade-mark { width: 36px; height: 36px; }
  }
  