/* ============================================================
   TradeJournal — Accounts Stylesheet
   Reuses .stat-strip (main.css), .trade-modal/.at-modal chrome,
   and .strat-form layout (strategies.css) so it's visually
   consistent with the rest of the app. Card treatment leans on
   the DESIGN-supabase.md elevation system (Level 0 flat →
   Level 1 subtle lift on hover) for a slightly more "premium"
   feel than the flat Strategy cards, without introducing any
   gradient or shadow outside the spec.
   ============================================================ */

/* ── Summary strip — 3-col override of the shared 6-col .stat-strip ── */
.acc-summary-strip {
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: var(--s-xl);
}

/* ── Card grid ──────────────────────────────────────────── */
.acc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--s-lg);
}

.acc-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--s-lg);
    background: var(--canvas);
    border: 1px solid var(--hairline-cool);
    border-radius: var(--r-lg);
    padding: var(--s-xl);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.acc-card:hover {
    border-color: var(--hairline-strong);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.acc-card:hover .acc-card__actions {
    opacity: 1;
}

/* ── Head: name + broker + type badge ───────────────────── */
.acc-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-md);
}

.acc-card__id {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.acc-card__name {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acc-card__head-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
}

.acc-card__actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: none;
    opacity: 0;
    transition: opacity 120ms ease;
}

/* Icon buttons — identical convention to strat-icon-btn */
.acc-icon-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    color: var(--ink-mute);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.acc-icon-btn:hover {
    background: var(--canvas-soft);
    color: var(--ink);
}

.acc-icon-btn.is-danger:hover {
    background: var(--loss-tint);
    color: var(--loss-deep);
}

.acc-icon-btn.is-confirm-delete {
    width: auto;
    padding: 0 10px;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    background: var(--loss-tint);
    color: var(--loss-deep);
}

.acc-icon-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Type badge (pill) — sits top-right of the card, next to
   the hover-revealed edit/delete icons ── */
.acc-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex: none;
}

.acc-type-badge svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acc-type-badge.is-personal,
.acc-type-badge.is-propfirm,
.acc-type-badge.is-demo {
    background: var(--canvas-soft);
    color: var(--ink-mute);
    border: 1px solid var(--hairline-cool);
}

/* ── Net P&L — the big headline number (no starting balance
   shown; this card is about performance, not bookkeeping) ── */
.acc-card__pnl {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.6px;
    line-height: 1;
}

.acc-card__pnl.is-positive {
    color: var(--primary-deep);
}

.acc-card__pnl.is-negative {
    color: var(--loss-deep);
}

/* ── 2x2 stat grid — Trades | Win Rate / Wins | Max DD ──── */
.acc-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-md) var(--s-lg);
}

.acc-stat-cell {
    min-width: 0;
}

.acc-stat__label {
    display: block;
    font-size: 11px;
    color: var(--ink-mute-2);
    margin-bottom: 3px;
}

.acc-stat__value {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.2px;
}

.acc-stat__value.is-wins {
    color: var(--primary-deep);
}

.acc-stat__value.is-winrate {
    color: var(--neutral-amber-deep, #d1891f);
}

.acc-stat__value.is-maxdd {
    color: var(--loss-deep);
}

/* ── Prop firm evaluation progress ──────────────────────── */
.acc-eval {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: var(--s-md);
    background: var(--canvas-soft);
    border-radius: var(--r-md);
}

.acc-eval__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.acc-eval__label {
    color: var(--ink-mute);
}

.acc-eval__value {
    font-weight: 500;
    color: var(--ink);
}

.acc-eval__bar-track {
    position: relative;
    height: 6px;
    border-radius: var(--r-full);
    background: var(--hairline-cool);
    overflow: hidden;
}

.acc-eval__bar-fill {
    height: 100%;
    border-radius: var(--r-full);
    background: var(--primary);
    transition: width 300ms ease;
}

.acc-eval__bar-fill.is-warning {
    background: var(--neutral-amber, #f5a623);
}

.acc-eval__bar-fill.is-danger {
    background: var(--loss);
}

/* ── Empty state ─────────────────────────────────────────── */
.acc-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--s-xxl, 40px);
    color: var(--ink-mute);
    font-size: 13px;
    border: 1px dashed var(--hairline-cool);
    border-radius: var(--r-lg);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .acc-summary-strip {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .acc-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 640px) {
    .acc-summary-strip {
        grid-template-columns: 1fr;
    }

    .acc-summary-strip .stat-cell+.stat-cell {
        border-left: none;
        border-top: 1px solid var(--hairline-cool);
    }

    .acc-grid {
        grid-template-columns: 1fr;
    }
}