/* FH Escrow — Frontend CSS
   All selectors scoped to .fhe-* to avoid theme conflicts.
   Primary: #f16a22 (orange — matches fh-jobs, fh-dashboard)
   ─────────────────────────────────────────────────────────── */

/* ── Reset / base ──────────────────────────────────────────── */
.fhe-wrap * { box-sizing: border-box; margin: 0; padding: 0; }
.fhe-wrap { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #1e293b; line-height: 1.5; }

/* ── Layout ────────────────────────────────────────────────── */
.fhe-wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
.fhe-detail-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
@media (max-width: 768px) { .fhe-detail-layout { grid-template-columns: 1fr; } }

/* ── Breadcrumb ────────────────────────────────────────────── */
.fhe-breadcrumb { margin-bottom: 20px; font-size: 13px; }
.fhe-breadcrumb a { color: #f16a22; text-decoration: none; }
.fhe-breadcrumb a:hover { text-decoration: underline; }

/* ── Cards ─────────────────────────────────────────────────── */
.fhe-detail-card,
.fhe-sidebar-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}
.fhe-sidebar-card { padding: 18px; }
.fhe-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fhe-sidebar-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 14px;
}

/* ── Page header ───────────────────────────────────────────── */
.fhe-page-header { margin-bottom: 24px; }
.fhe-page-title  { font-size: 22px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.fhe-page-subtitle { font-size: 14px; color: #64748b; }

/* ── Summary grid ──────────────────────────────────────────── */
.fhe-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 640px) { .fhe-summary-grid { grid-template-columns: repeat(2, 1fr); } }

.fhe-summary-stat {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
}
.fhe-summary-stat-label { display: block; font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.fhe-summary-stat-value { display: block; font-size: 22px; font-weight: 700; color: #1e293b; }

/* ── Contract cards (list view) ────────────────────────────── */
.fhe-contract-list { display: flex; flex-direction: column; gap: 14px; }
.fhe-contract-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow .15s;
}
.fhe-contract-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.fhe-contract-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 18px 20px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.fhe-contract-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #f8fafc;
    gap: 16px;
    flex-wrap: wrap;
}
.fhe-contract-job-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.fhe-contract-job-title a { color: #1e293b; text-decoration: none; }
.fhe-contract-job-title a:hover { color: #f16a22; }
.fhe-contract-meta { font-size: 12px; color: #94a3b8; }
.fhe-contract-status { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.fhe-contract-stats { display: flex; gap: 20px; }
.fhe-contract-stat-label { font-size: 11px; color: #94a3b8; display: block; }
.fhe-contract-stat-value { font-size: 15px; font-weight: 700; color: #1e293b; }

/* ── Milestone rows ────────────────────────────────────────── */
.fhe-milestone-list { display: flex; flex-direction: column; gap: 1px; }
.fhe-milestone-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}
.fhe-milestone-row:last-child { border-bottom: none; }
.fhe-milestone-info { flex: 1; min-width: 0; }
.fhe-milestone-title { font-size: 14px; font-weight: 500; color: #1e293b; margin-bottom: 4px; }
.fhe-milestone-desc  { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.fhe-milestone-meta  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fhe-milestone-due, .fhe-milestone-autorelease { font-size: 11px; color: #94a3b8; }
.fhe-milestone-amount-wrap { text-align: right; flex-shrink: 0; }
.fhe-milestone-amount { display: block; font-size: 16px; font-weight: 700; color: #1e293b; }
.fhe-milestone-payout-note { font-size: 11px; color: #22c55e; display: block; margin-top: 2px; }
.fhe-milestone-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }

/* ── Status pills ──────────────────────────────────────────── */
.fhe-status-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .02em;
    line-height: 1.6;
}
.fhe-status-pending          { background: #f1f5f9; color: #475569; }
.fhe-status-funded,
.fhe-status-submitted        { background: #fef3c7; color: #92400e; }
.fhe-status-approved         { background: #dcfce7; color: #166534; }
.fhe-status-disputed         { background: #fce7f3; color: #831843; }
.fhe-status-refunded         { background: #f1f5f9; color: #64748b; }
.fhe-status-active           { background: #eff6ff; color: #1e40af; }
.fhe-status-completed        { background: #dcfce7; color: #166534; }
.fhe-status-cancelled        { background: #fef2f2; color: #991b1b; }
.fhe-status-succeeded        { background: #dcfce7; color: #166534; }
.fhe-status-failed           { background: #fef2f2; color: #991b1b; }

/* Urgent pill */
.fhe-urgent-pill { background: #fff7ed; color: #c2410c; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 99px; display: inline-flex; align-items: center; gap: 4px; }

/* ── Status badges (larger) ────────────────────────────────── */
.fhe-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 14px;
}
.fhe-status-badge--success { background: #dcfce7; color: #166534; }
.fhe-status-badge--warning { background: #fef3c7; color: #92400e; }

/* ── Connect card ──────────────────────────────────────────── */
.fhe-connect-wrap { max-width: 520px; margin: 40px auto; }
.fhe-connect-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 36px 32px;
    text-align: center;
}
.fhe-connect-icon { color: #f16a22; margin-bottom: 16px; }
.fhe-connect-title { font-size: 20px; font-weight: 700; color: #1e293b; margin-bottom: 8px; }
.fhe-connect-subtitle { font-size: 14px; color: #64748b; margin-bottom: 24px; line-height: 1.6; }
.fhe-connect-detail { font-size: 13px; color: #475569; margin: 12px 0 18px; }
.fhe-connect-info { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; text-align: left; margin-bottom: 18px; }
.fhe-info-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px; }
.fhe-info-row:last-child { border-bottom: none; }
.fhe-info-label { color: #94a3b8; }
.fhe-info-value { font-weight: 500; color: #1e293b; }

/* Connect steps */
.fhe-connect-steps { text-align: left; margin-bottom: 24px; display: flex; flex-direction: column; gap: 12px; }
.fhe-step { display: flex; gap: 14px; align-items: flex-start; }
.fhe-step-num {
    width: 28px; height: 28px; flex-shrink: 0;
    background: #f16a22; color: #fff;
    border-radius: 50%;
    font-size: 13px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.fhe-step strong { display: block; font-size: 13px; font-weight: 600; color: #1e293b; margin-bottom: 2px; }
.fhe-step p { font-size: 12px; color: #64748b; }
.fhe-fee-note {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #78350f;
    text-align: left;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* ── Forms ─────────────────────────────────────────────────── */
.fhe-form { display: flex; flex-direction: column; gap: 14px; }
.fhe-form-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.fhe-form-field { display: flex; flex-direction: column; gap: 5px; }
.fhe-form-field--grow { flex: 1; min-width: 160px; }
.fhe-form-field--amount { width: 130px; }
.fhe-label { font-size: 12px; font-weight: 500; color: #475569; }
.fhe-required { color: #f16a22; }
.fhe-input, .fhe-textarea {
    border: 1px solid #d1d5db;
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 13px;
    color: #1e293b;
    width: 100%;
    background: #fff;
    transition: border-color .15s;
}
.fhe-input:focus, .fhe-textarea:focus { border-color: #f16a22; outline: none; box-shadow: 0 0 0 3px rgba(241,106,34,.12); }
.fhe-textarea { resize: vertical; }

/* ── Buttons ───────────────────────────────────────────────── */
.fhe-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s, opacity .15s;
    text-decoration: none;
    white-space: nowrap;
}
.fhe-btn:disabled { opacity: .55; cursor: not-allowed; }
.fhe-btn-primary   { background: #f16a22; color: #fff; border-color: #f16a22; }
.fhe-btn-primary:hover:not(:disabled) { background: #d95f1b; border-color: #d95f1b; }
.fhe-btn-success   { background: #16a34a; color: #fff; border-color: #16a34a; }
.fhe-btn-success:hover:not(:disabled) { background: #15803d; }
.fhe-btn-outline   { background: #fff; color: #f16a22; border-color: #f16a22; }
.fhe-btn-outline:hover:not(:disabled) { background: #fff7f3; }
.fhe-btn-ghost     { background: transparent; color: #64748b; border-color: #d1d5db; }
.fhe-btn-ghost:hover:not(:disabled) { background: #f8fafc; color: #1e293b; }
.fhe-btn-lg        { padding: 13px 28px; font-size: 15px; border-radius: 10px; }
.fhe-btn-sm        { padding: 5px 12px; font-size: 12px; border-radius: 6px; }

/* Spinner */
.fhe-btn-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fhe-spin .6s linear infinite;
}
.fhe-btn-outline .fhe-btn-spinner,
.fhe-btn-ghost .fhe-btn-spinner {
    border-color: rgba(241,106,34,.3);
    border-top-color: #f16a22;
}
@keyframes fhe-spin { to { transform: rotate(360deg); } }
.fhe-hidden { display: none !important; }

/* ── Notices ───────────────────────────────────────────────── */
.fhe-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}
.fhe-notice--success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.fhe-notice--warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.fhe-notice--error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.fhe-notice--info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.fhe-notice a        { color: inherit; text-decoration: underline; }

/* Messages (AJAX feedback) */
.fhe-messages { margin-top: 10px; }
.fhe-msg { padding: 10px 14px; border-radius: 7px; font-size: 13px; margin-bottom: 6px; }
.fhe-msg--success { background: #dcfce7; color: #166534; }
.fhe-msg--error   { background: #fef2f2; color: #991b1b; }

/* ── Tables ────────────────────────────────────────────────── */
.fhe-history-table-wrap { overflow-x: auto; }
.fhe-history-table,
.fhe-txlog-table,
.fhe-admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.fhe-history-table th,
.fhe-txlog-table th,
.fhe-admin-table th {
    text-align: left;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid #e2e8f0;
}
.fhe-history-table td,
.fhe-txlog-table td,
.fhe-admin-table td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
    vertical-align: middle;
}
.fhe-history-table tr:last-child td,
.fhe-txlog-table tr:last-child td,
.fhe-admin-table tr:last-child td { border-bottom: none; }
.fhe-history-date { color: #64748b; }
.fhe-history-amount { font-weight: 600; }

/* ── Transaction log widget ────────────────────────────────── */
.fhe-txlog-wrap { margin-top: 20px; }
.fhe-txlog-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.fhe-txlog-title { font-size: 14px; font-weight: 600; color: #1e293b; }
.fhe-txlog-view-all { font-size: 12px; color: #f16a22; text-decoration: none; }
.fhe-txlog-view-all:hover { text-decoration: underline; }

/* ── Milestones compact widget ─────────────────────────────── */
.fhe-milestones-compact { display: flex; flex-direction: column; gap: 12px; }
.fhe-milestones-compact-group { }
.fhe-milestones-job-title { font-size: 13px; font-weight: 600; color: #1e293b; text-decoration: none; display: block; margin-bottom: 6px; }
.fhe-milestones-job-title:hover { color: #f16a22; }
.fhe-milestones-compact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
}
.fhe-milestones-compact-title { flex: 1; color: #475569; }
.fhe-milestones-compact-amount { font-weight: 600; color: #1e293b; margin-left: auto; }
.fhe-compact-view-all { font-size: 12px; color: #f16a22; text-decoration: none; display: block; margin-top: 8px; }
.fhe-compact-view-all:hover { text-decoration: underline; }

/* ── Escrow summary strip ──────────────────────────────────── */
.fhe-escrow-summary-strip {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 16px;
}
.fhe-summary-strip-stat { }
.fhe-summary-strip-label { display: block; font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.fhe-summary-strip-value { font-size: 18px; font-weight: 700; color: #1e293b; }
.fhe-summary-strip-link { margin-left: auto; font-size: 12px; color: #f16a22; text-decoration: none; }
.fhe-summary-strip-link:hover { text-decoration: underline; }

/* ── Admin escrow wrap ─────────────────────────────────────── */
.fhe-admin-escrow-wrap { max-width: 100%; }
.fhe-admin-actions-cell { min-width: 160px; }
.fhe-admin-job-link { color: #f16a22; text-decoration: none; font-weight: 500; }
.fhe-admin-job-link:hover { text-decoration: underline; }

/* ── Admin reports stats ───────────────────────────────────── */
.fhe-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 768px) { .fhe-admin-stats { grid-template-columns: repeat(2, 1fr); } }
.fhe-admin-stat-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 18px;
}
.fhe-admin-stat-label { display: block; font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.fhe-admin-stat-value { display: block; font-size: 24px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.fhe-admin-stat-note  { display: block; font-size: 11px; color: #94a3b8; }

/* ── Utility classes ───────────────────────────────────────── */
.fhe-text-orange  { color: #f16a22 !important; }
.fhe-text-success { color: #16a34a !important; }
.fhe-text-muted   { color: #94a3b8 !important; }
.fhe-count-badge  { background: #f1f5f9; color: #64748b; font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 99px; }

/* Detail list (sidebar) */
.fhe-detail-list { list-style: none; }
.fhe-detail-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; gap: 8px; }
.fhe-detail-list li:last-child { border-bottom: none; }
.fhe-detail-list-label { color: #94a3b8; flex-shrink: 0; }

/* Empty states */
.fhe-empty-state { text-align: center; padding: 48px 20px; color: #94a3b8; }
.fhe-empty-state svg { margin-bottom: 14px; opacity: .4; }
.fhe-empty-state p { font-size: 14px; margin-bottom: 4px; }
.fhe-empty-state .fhe-empty-sub { font-size: 12px; }
.fhe-empty-state-sm { padding: 20px 0; color: #94a3b8; font-size: 13px; text-align: center; }
.fhe-empty-text { font-size: 13px; color: #94a3b8; }
