/* ============ ACE SYSTEM FRONTEND CSS v3.1 ============ */

/* === PORTAL BASE === */
.ace-portal { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; max-width:960px; margin:0 auto; color:#1f2937; }

/* === ALERTS === */
.ace-alert { padding:14px 18px; border-radius:10px; margin-bottom:16px; font-size:14px; }
.ace-alert-success { background:#d1fae5; color:#065f46; border-left:4px solid #10b981; }
.ace-alert-error   { background:#fee2e2; color:#991b1b; border-left:4px solid #ef4444; }
.ace-alert-warning { background:#fef3c7; color:#92400e; border-left:4px solid #f59e0b; }

/* === CARDS === */
.ace-card { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:20px; margin-bottom:16px; box-shadow:0 1px 4px rgba(0,0,0,.06); }
.ace-card h3 { margin:0 0 14px; font-size:16px; color:#111; }
.ace-card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.ace-card-warning { border-left:4px solid #f59e0b; }
.ace-card-green   { border-left:4px solid #10b981; }
.ace-card-action  { background:#fafafa; }

/* === PORTAL HEADER === */
.ace-portal-header { display:flex; justify-content:space-between; align-items:center; padding:14px 0; margin-bottom:14px; border-bottom:2px solid #e5e7eb; }
.ace-portal-user   { display:flex; align-items:center; gap:12px; }
.ace-portal-user h2 { margin:0; font-size:18px; }
.ace-portal-user small { color:#6b7280; }
.ace-avatar { width:44px; height:44px; background:#4f46e5; color:#fff; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:22px; }

/* === TABS === */
.ace-portal-tabs { display:flex; gap:4px; margin-bottom:18px; background:#f3f4f6; padding:5px; border-radius:10px; }
.ace-tab { flex:1; text-align:center; padding:9px 16px; border-radius:8px; text-decoration:none; color:#6b7280; font-size:14px; font-weight:500; transition:all .15s; }
.ace-tab.active,.ace-tab:hover { background:#4f46e5; color:#fff; }

/* === STATS ROW === */
.ace-stats-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; margin-bottom:18px; }
.ace-stat-card { background:#fff; border:1px solid #e5e7eb; border-left:4px solid #e5e7eb; border-radius:10px; padding:16px; text-align:center; }
.ace-stat-card.blue   { border-left-color:#3b82f6; }
.ace-stat-card.green  { border-left-color:#10b981; }
.ace-stat-card.orange { border-left-color:#f59e0b; }
.ace-stat-card.purple { border-left-color:#8b5cf6; }
.ace-stat-card.red    { border-left-color:#ef4444; }
.ace-stat-card.teal   { border-left-color:#0d9488; }
.ace-stat-num { font-size:20px; font-weight:800; color:#1f2937; display:block; }
.ace-stat-lbl { font-size:12px; color:#6b7280; margin-top:3px; display:block; }

/* === BUTTONS === */
.ace-btn { display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:9px 18px; border-radius:8px; border:1px solid transparent; font-size:14px; font-weight:500; cursor:pointer; text-decoration:none; transition:all .15s; }
.ace-btn-primary { background:#4f46e5; color:#fff; border-color:#4f46e5; }
.ace-btn-primary:hover { background:#4338ca; color:#fff; }
.ace-btn-outline { background:#fff; color:#374151; border-color:#d1d5db; }
.ace-btn-outline:hover { background:#f9fafb; border-color:#9ca3af; }
.ace-btn-block { width:100%; }
.ace-btn-lg { padding:12px 24px; font-size:16px; border-radius:10px; }
.ace-btn-sm { padding:6px 12px; font-size:13px; }

/* === INPUTS === */
.ace-input,.ace-select { width:100%; padding:10px 14px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; transition:border-color .2s; box-sizing:border-box; }
.ace-input:focus,.ace-select:focus { outline:none; border-color:#4f46e5; box-shadow:0 0 0 3px rgba(79,70,229,.1); }
.ace-input-lg { font-size:16px; padding:13px 16px; border-radius:10px; }

/* === FORM LAYOUT === */
.ace-form-section { background:#f9fafb; border:1px solid #e5e7eb; border-radius:12px; padding:18px; margin-bottom:16px; }
.ace-form-section h3 { margin:0 0 14px; font-size:15px; color:#374151; }
.ace-form-group { margin-bottom:12px; }
.ace-form-group label { display:block; font-size:13px; font-weight:600; color:#374151; margin-bottom:6px; }
.ace-form-group input,.ace-form-group select,.ace-form-group textarea { width:100%; padding:10px 14px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; box-sizing:border-box; }
.ace-form-group input:focus,.ace-form-group textarea:focus,.ace-form-group select:focus { outline:none; border-color:#4f46e5; box-shadow:0 0 0 3px rgba(79,70,229,.1); }
.ace-form-row-2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.ace-form-stack { display:flex; flex-direction:column; gap:8px; }
.req { color:#ef4444; }

/* Payment options */
.ace-payment-options { display:flex; flex-direction:column; gap:8px; }
.ace-payment-option { display:flex; align-items:center; gap:10px; padding:12px 16px; border:2px solid #e5e7eb; border-radius:10px; cursor:pointer; transition:all .15s; }
.ace-payment-option:has(input:checked) { border-color:#4f46e5; background:#eff6ff; }
.ace-payment-option input { width:auto; margin:0; }
.ace-payment-label { font-size:14px; font-weight:500; }

/* Preview box */
.ace-preview-box { background:#f0fdf4; border:2px solid #86efac; border-radius:12px; padding:16px; margin-top:12px; }
.ace-preview-box h4 { margin:0 0 12px; color:#065f46; }
.ace-preview-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; }
.ace-preview-grid div { text-align:center; }
.ace-preview-grid span { display:block; font-size:12px; color:#6b7280; }
.ace-preview-grid strong { display:block; font-size:14px; color:#1f2937; }
.ace-preview-grid .pv-total { grid-column:1/-1; }

/* Spinner */
.ace-spinner { display:inline-block; width:20px; height:20px; border:3px solid #e5e7eb; border-top-color:#4f46e5; border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* === LOGIN BOX === */
.ace-login-box { max-width:440px; margin:40px auto; background:#fff; border:1px solid #e5e7eb; border-radius:16px; padding:36px; box-shadow:0 4px 20px rgba(0,0,0,.08); }
.ace-login-header { text-align:center; margin-bottom:24px; }
.ace-login-icon { font-size:48px; margin-bottom:8px; }
.ace-login-header h2 { margin:0 0 6px; font-size:22px; }
.ace-login-header p  { margin:0; color:#6b7280; font-size:14px; }
.ace-login-form { display:flex; flex-direction:column; gap:14px; }
.ace-field { display:flex; flex-direction:column; gap:6px; }
.ace-field label { font-size:13px; font-weight:600; color:#374151; }
.ace-field input { padding:11px 14px; border:1px solid #d1d5db; border-radius:8px; font-size:15px; transition:border-color .2s; }
.ace-field input:focus { outline:none; border-color:#4f46e5; box-shadow:0 0 0 3px rgba(79,70,229,.1); }
.ace-password-wrap { position:relative; }
.ace-password-wrap input { padding-right:44px; width:100%; box-sizing:border-box; }
.ace-toggle-pass { position:absolute; right:10px; top:50%; transform:translateY(-50%); background:none; border:none; cursor:pointer; font-size:18px; padding:4px; }

/* === TABLES === */
.ace-table-wrap { overflow-x:auto; }
.ace-table { width:100%; border-collapse:collapse; font-size:14px; }
.ace-table th { background:#f9fafb; padding:10px 14px; text-align:left; font-size:12px; font-weight:600; color:#6b7280; border-bottom:2px solid #e5e7eb; }
.ace-table td { padding:12px 14px; border-bottom:1px solid #f3f4f6; }
.ace-table tbody tr:hover { background:#fafafa; }

/* === STATUS === */
.ace-status { display:inline-block; padding:3px 10px; border-radius:20px; font-size:12px; font-weight:600; white-space:nowrap; }
.ace-status-pending      { background:#fef3c7; color:#92400e; }
.ace-status-confirmed    { background:#d1fae5; color:#065f46; }
.ace-status-assigned     { background:#dbeafe; color:#1e40af; }
.ace-status-processing   { background:#ede9fe; color:#5b21b6; }
.ace-status-shipped      { background:#e0f2fe; color:#0369a1; }
.ace-status-delivering   { background:#fef9c3; color:#713f12; }
.ace-status-completed    { background:#d1fae5; color:#065f46; }
.ace-status-cod_received { background:#d1fae5; color:#065f46; }
.ace-status-cancelled    { background:#fee2e2; color:#991b1b; }
.ace-status-returned     { background:#f3f4f6; color:#4b5563; }
.ace-badge-warning       { background:#fef3c7; color:#92400e; padding:2px 8px; border-radius:20px; font-size:11px; font-weight:600; }
.ace-badge-error         { background:#fee2e2; color:#991b1b; padding:2px 8px; border-radius:20px; font-size:11px; font-weight:600; }

/* === PAID/UNPAID === */
.ace-paid   { color:#059669; font-size:12px; }
.ace-unpaid { color:#d97706; font-size:12px; }
.ace-na     { color:#9ca3af; font-size:12px; }

/* === INFO TABLE === */
.ace-info-table { width:100%; border-collapse:collapse; }
.ace-info-table th,.ace-info-table td { padding:9px 12px; border-bottom:1px solid #f3f4f6; font-size:14px; text-align:left; }
.ace-info-table th { color:#6b7280; font-weight:500; width:40%; background:#fafafa; }
.ace-row-highlight td { background:#f0fdf4; font-weight:600; }

/* === PORTAL COLS === */
.ace-portal-cols  { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
.ace-portal-col   { min-width:0; }
.ace-detail-cols  { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.ace-detail-col   { min-width:0; }

/* === ORDER DETAIL HEADER === */
.ace-order-detail-header { display:flex; align-items:center; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.ace-order-detail-header h2 { margin:0; font-size:20px; }

/* === PERIOD FILTER === */
.ace-period-filter { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:16px; }
.ace-period-btn { padding:6px 14px; border:1px solid #e5e7eb; border-radius:20px; text-decoration:none; color:#374151; font-size:13px; transition:all .15s; }
.ace-period-btn.active,.ace-period-btn:hover { background:#4f46e5; color:#fff; border-color:#4f46e5; }

/* === STATUS FILTER === */
.ace-status-filter { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:14px; }
.ace-filter-btn { padding:5px 12px; border:1px solid #e5e7eb; border-radius:20px; text-decoration:none; color:#374151; font-size:12px; transition:all .15s; }
.ace-filter-btn.active { background:#4f46e5; color:#fff; border-color:#4f46e5; }

/* === TIMELINE === */
.ace-timeline { position:relative; padding-left:26px; }
.ace-timeline::before { content:''; position:absolute; left:9px; top:0; bottom:0; width:2px; background:#e5e7eb; }
.ace-timeline-item { position:relative; margin-bottom:16px; }
.ace-timeline-dot { width:16px; height:16px; background:#4f46e5; border-radius:50%; position:absolute; left:-22px; top:3px; border:2px solid #fff; box-shadow:0 0 0 2px #4f46e5; }
.ace-actor-system   .ace-timeline-dot { background:#9ca3af; box-shadow:0 0 0 2px #9ca3af; }
.ace-actor-supplier .ace-timeline-dot { background:#f59e0b; box-shadow:0 0 0 2px #f59e0b; }
.ace-timeline-content strong { display:block; font-size:14px; color:#111; }
.ace-timeline-note  { display:block; font-size:13px; color:#6b7280; }
.ace-timeline-content small { display:block; font-size:12px; color:#9ca3af; margin-top:2px; }

/* === REF LINK CARD === */
.ace-reflink-card { background:linear-gradient(135deg,#667eea 0%,#764ba2 100%); color:#fff; }
.ace-reflink-card h3 { color:#fff; margin:0 0 12px; }
.ace-reflink-wrap { display:flex; gap:8px; }
.ace-reflink-wrap .ace-input { background:rgba(255,255,255,.15); border-color:rgba(255,255,255,.3); color:#fff; font-family:monospace; }
.ace-reflink-wrap .ace-btn-primary { background:rgba(255,255,255,.25); border-color:transparent; }
.ace-reflink-wrap .ace-btn-primary:hover { background:rgba(255,255,255,.4); }

/* === FILTER FORM (Supplier orders) === */
.ace-filter-form { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px; align-items:center; }
.ace-filter-form .ace-input,.ace-filter-form .ace-select { max-width:200px; }

/* === ORDER CARDS (Supplier) === */
.ace-orders-list { display:flex; flex-direction:column; gap:12px; }
.ace-order-card { background:#fff; border:1px solid #e5e7eb; border-left:4px solid #e5e7eb; border-radius:12px; padding:16px; transition:all .15s; }
.ace-order-card:hover { box-shadow:0 2px 8px rgba(0,0,0,.1); }
.ace-order-card-head { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:10px; }
.ace-order-code { font-size:16px; font-weight:700; color:#1f2937; }
.ace-order-card-body { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.ace-order-info { display:flex; flex-direction:column; gap:3px; font-size:13px; color:#6b7280; }
.ace-order-money { text-align:right; }
.ace-money-label { display:block; font-size:12px; color:#6b7280; }
.ace-money-value { display:block; font-size:18px; font-weight:700; color:#059669; }
.ace-order-shipping { font-size:12px; color:#6b7280; margin-top:8px; padding-top:8px; border-top:1px solid #f3f4f6; }
.ace-order-card-foot { margin-top:12px; padding-top:12px; border-top:1px solid #f3f4f6; text-align:right; }
.ace-status-border-assigned   { border-left-color:#3b82f6; }
.ace-status-border-processing { border-left-color:#8b5cf6; }
.ace-status-border-shipped    { border-left-color:#0ea5e9; }
.ace-status-border-delivering { border-left-color:#f59e0b; }
.ace-status-border-completed  { border-left-color:#10b981; }
.ace-status-border-cod_received { border-left-color:#10b981; }

/* === TRACKING === */
.ace-tracking-header { text-align:center; margin-bottom:20px; }
.ace-tracking-header h2 { margin:0 0 6px; font-size:24px; }
.ace-tracking-header p  { color:#6b7280; margin:0; }
.ace-tracking-form { display:flex; justify-content:center; margin-bottom:24px; }
.ace-tracking-input-wrap { display:flex; gap:8px; width:100%; max-width:480px; }
.ace-tracking-input-wrap .ace-input-lg { flex:1; }
.ace-tracking-found { color:#059669; font-size:15px; margin-bottom:14px; }
.ace-tracking-empty { text-align:center; padding:30px; color:#6b7280; }
.ace-tracking-card { background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:18px; margin-bottom:14px; }
.ace-tracking-cancelled { opacity:.7; border-style:dashed; }
.ace-tracking-card-head { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:14px; }

/* Progress steps */
.ace-progress-wrap { margin-bottom:16px; }
.ace-progress-steps { display:flex; justify-content:space-between; position:relative; }
.ace-progress-steps::before { content:''; position:absolute; top:16px; left:8%; right:8%; height:2px; background:#e5e7eb; z-index:0; }
.ace-step { flex:1; text-align:center; position:relative; z-index:1; }
.ace-step-icon { width:32px; height:32px; background:#e5e7eb; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:14px; margin:0 auto 5px; transition:all .3s; }
.ace-step-label { font-size:10px; color:#9ca3af; }
.ace-step.done .ace-step-icon { background:#10b981; }
.ace-step.active .ace-step-icon { background:#4f46e5; box-shadow:0 0 0 4px rgba(79,70,229,.2); }
.ace-step.done .ace-step-label,.ace-step.active .ace-step-label { color:#374151; font-weight:600; }

.ace-tracking-info { display:flex; flex-direction:column; gap:8px; }
.ace-tracking-row { display:flex; justify-content:space-between; align-items:center; font-size:14px; padding:6px 0; border-bottom:1px solid #f3f4f6; }
.ace-tracking-row:last-child { border-bottom:none; }
.ace-tracking-row span:first-child { color:#6b7280; }

/* === SHIPPING INFO === */
.ace-shipping-info { background:#eff6ff; padding:10px 14px; border-radius:8px; font-size:14px; }

/* === PAGINATION === */
.ace-pagination { display:flex; flex-wrap:wrap; gap:5px; margin-top:18px; align-items:center; }
.ace-page-btn { padding:6px 12px; border:1px solid #e5e7eb; border-radius:6px; text-decoration:none; color:#374151; font-size:13px; transition:all .15s; }
.ace-page-btn.active,.ace-page-btn:hover { background:#4f46e5; color:#fff; border-color:#4f46e5; }
.ace-page-info { font-size:13px; color:#9ca3af; margin-left:8px; }

/* === EMPTY STATE === */
.ace-empty-state { text-align:center; padding:40px; color:#9ca3af; background:#fafafa; border-radius:12px; border:2px dashed #e5e7eb; }
.ace-empty { color:#9ca3af; font-size:13px; font-style:italic; }
.ace-link { color:#4f46e5; text-decoration:none; font-size:13px; }
.ace-link:hover { text-decoration:underline; }

/* === COUNT === */
.ace-count { background:#ede9fe; color:#5b21b6; padding:1px 8px; border-radius:20px; font-size:13px; font-weight:600; }

/* === RESPONSIVE === */
@media (max-width:768px) {
    .ace-portal-cols  { grid-template-columns:1fr; }
    .ace-detail-cols  { grid-template-columns:1fr; }
    .ace-form-row-2   { grid-template-columns:1fr; }
    .ace-stats-row    { grid-template-columns:repeat(2,1fr); }
    .ace-login-box    { margin:10px; padding:24px; }
    .ace-progress-steps::before { display:none; }
    .ace-step-label   { display:none; }
    .ace-tracking-input-wrap { flex-direction:column; }
    .ace-order-card-body { flex-direction:column; align-items:flex-start; }
}

/* ═══════════════════════════════════════════
   ORDER FORM - REDESIGNED
═══════════════════════════════════════════ */
.ace-order-wrap {
    max-width: 680px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.ace-success-box {
    text-align: center;
    padding: 48px 32px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 2px solid #86efac;
    border-radius: 16px;
}
.ace-success-icon { font-size: 56px; margin-bottom: 12px; }
.ace-success-box h2 { color: #065f46; margin: 0 0 8px; font-size: 24px; }
.ace-success-box p  { color: #047857; margin: 0 0 12px; }
.ace-success-note   { font-size: 14px; color: #6b7280 !important; }
.ace-order-code-box {
    display: inline-block;
    background: #fff;
    border: 2px solid #4f46e5;
    border-radius: 12px;
    padding: 12px 32px;
    font-size: 26px;
    font-weight: 800;
    color: #4f46e5;
    letter-spacing: 2px;
    margin: 10px 0 20px;
}
.ace-success-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.ace-btn-ghost {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #6b7280;
}

/* Form sections */
.ace-form-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.ace-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}
.ace-section-header h3 { margin: 0; font-size: 16px; font-weight: 700; color: #1f2937; }
.ace-step-num {
    width: 28px; height: 28px;
    background: linear-gradient(135deg,#4f46e5,#7c3aed);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}

/* Combo cards */
.ace-combo-selector { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 10px; margin-bottom: 16px; }
.ace-combo-card {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}
.ace-combo-card:hover { border-color: #a5b4fc; background: #fafafe; }
.ace-combo-card.selected { border-color: #4f46e5; background: #f5f3ff; }
.ace-combo-card input[type=radio] { display: none; }
.ace-combo-info { flex: 1; }
.ace-combo-name { font-size: 15px; font-weight: 700; color: #1f2937; margin-bottom: 2px; }
.ace-combo-code { font-size: 12px; color: #9ca3af; font-family: monospace; }
.ace-combo-desc { font-size: 12px; color: #6b7280; margin-top: 4px; }
.ace-combo-price { font-size: 14px; color: #4f46e5; font-weight: 600; margin-top: 6px; }
.ace-combo-check {
    width: 22px; height: 22px;
    background: #4f46e5; color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity .2s;
    flex-shrink: 0;
}
.ace-combo-card.selected .ace-combo-check { opacity: 1; }

/* Qty */
.ace-qty-row { margin-top: 4px; }
.ace-qty-input-wrap { display: flex; align-items: center; gap: 0; max-width: 160px; }
.ace-qty-btn {
    width: 40px; height: 44px;
    background: #f3f4f6; border: 1px solid #e5e7eb;
    font-size: 20px; font-weight: 700; cursor: pointer;
    color: #374151; transition: background .2s;
    flex-shrink: 0;
}
.ace-qty-btn:first-child { border-radius: 8px 0 0 8px; }
.ace-qty-btn:last-child  { border-radius: 0 8px 8px 0; }
.ace-qty-btn:hover { background: #e5e7eb; }
.ace-qty-input {
    width: 72px; height: 44px;
    border: 1px solid #e5e7eb; border-left: none; border-right: none;
    text-align: center; font-size: 18px; font-weight: 700;
    background: #fff; outline: none; color: #1f2937;
}
.ace-field-note { font-size: 13px; color: #4f46e5; margin-top: 6px; font-weight: 500; }

/* Preview card */
.ace-preview-card {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 2px solid #c4b5fd;
    border-radius: 12px;
    padding: 18px 20px;
    margin-top: 16px;
}
.ace-preview-title { font-size: 14px; font-weight: 700; color: #5b21b6; margin-bottom: 12px; }
.ace-preview-rows { display: flex; flex-direction: column; gap: 8px; }
.ace-preview-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.ace-preview-row span { color: #6b7280; }
.ace-preview-row strong { color: #1f2937; }
.ace-preview-total { padding-top: 10px; border-top: 2px solid #c4b5fd; margin-top: 4px; }
.ace-preview-total span { font-weight: 600; color: #374151; }
.ace-price-big { font-size: 22px; font-weight: 800; color: #4f46e5; }
.ace-qty-fixed-note { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 8px 12px; margin-top: 10px; font-size: 13px; color: #92400e; }
.ace-preview-loading { text-align: center; color: #7c3aed; font-size: 13px; padding: 8px 0; }

/* Form inputs */
.ace-form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width:520px){ .ace-form-grid-2 { grid-template-columns: 1fr; } }
.ace-form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.ace-label { font-size: 14px; font-weight: 600; color: #374151; }
.ace-req  { color: #ef4444; }
.ace-opt  { color: #9ca3af; font-weight: 400; font-size: 13px; }
.ace-input {
    padding: 11px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #1f2937;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .2s;
    outline: none;
    font-family: inherit;
}
.ace-input:focus { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.ace-textarea { resize: vertical; min-height: 80px; }

/* Payment */
.ace-payment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media(max-width:480px){ .ace-payment-grid { grid-template-columns: 1fr; } }
.ace-payment-card {
    border: 2px solid #e5e7eb; border-radius: 12px; padding: 14px 16px;
    cursor: pointer; display: flex; align-items: center; gap: 12px;
    transition: all .2s; position: relative;
}
.ace-payment-card:hover { border-color: #a5b4fc; background: #fafafe; }
.ace-payment-card.selected { border-color: #4f46e5; background: #f5f3ff; }
.ace-payment-card input[type=radio] { display: none; }
.ace-payment-icon { font-size: 24px; flex-shrink: 0; }
.ace-payment-info { flex: 1; }
.ace-payment-info strong { display: block; font-size: 14px; color: #1f2937; }
.ace-payment-info span   { font-size: 12px; color: #6b7280; }
.ace-payment-check {
    width: 20px; height: 20px; background: #4f46e5; color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 11px; opacity: 0; transition: opacity .2s; flex-shrink: 0;
}
.ace-payment-card.selected .ace-payment-check { opacity: 1; }

/* Submit */
.ace-submit-wrap { text-align: center; padding: 8px 0 16px; }
.ace-btn-xl {
    padding: 16px 48px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 14px rgba(79,70,229,.35);
}
.ace-submit-note { font-size: 13px; color: #9ca3af; margin-top: 10px; }
.ace-loading-bar {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 14px;
    background: #f5f3ff; border-radius: 10px; margin-bottom: 12px;
    color: #4f46e5; font-weight: 500;
}

/* ═══════════════════════════════════════════
   CUSTOMER TRACKING - REDESIGNED
═══════════════════════════════════════════ */
.ace-tracking-wrap {
    max-width: 700px; margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.ace-tracking-header { text-align: center; padding: 20px 0 10px; }
.ace-tracking-header h2 { font-size: 24px; font-weight: 800; color: #1f2937; margin: 0 0 6px; }
.ace-tracking-header p  { color: #6b7280; margin: 0; font-size: 15px; }
.ace-tracking-form { padding: 16px 0 24px; }
.ace-tracking-input-row { display: flex; gap: 8px; }
.ace-tracking-input {
    flex: 1;
    padding: 13px 18px !important;
    font-size: 17px !important;
    border-radius: 12px !important;
    border-width: 2px !important;
}
.ace-btn-track { padding: 13px 28px !important; border-radius: 12px !important; white-space: nowrap; font-size: 15px !important; }
@media(max-width:480px){ .ace-tracking-input-row { flex-direction: column; } }

.ace-tracking-empty { text-align: center; padding: 40px 20px; }
.ace-tracking-empty h3 { font-size: 18px; color: #374151; margin: 0 0 8px; }
.ace-tracking-empty p  { color: #6b7280; margin: 4px 0; }
.ace-track-note { font-size: 13px; color: #9ca3af !important; }
.ace-track-count { font-size: 14px; color: #6b7280; margin-bottom: 16px; }

/* Order card */
.ace-order-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.ace-order-card.ace-order-done  { border-color: #86efac; }
.ace-order-card.ace-order-cancel{ border-color: #fca5a5; }
.ace-order-card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid #f3f4f6; flex-wrap: wrap; gap: 8px;
}
.ace-order-num  { font-size: 18px; font-weight: 800; color: #4f46e5; font-family: monospace; letter-spacing: 1px; }
.ace-order-date { font-size: 13px; color: #9ca3af; margin-top: 2px; }
.ace-status-badge {
    padding: 5px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 600;
    background: #f3f4f6; color: #374151;
}
.ace-status-badge.ace-status-completed, .ace-status-badge.ace-status-cod_received { background: #dcfce7; color: #065f46; }
.ace-status-badge.ace-status-cancelled, .ace-status-badge.ace-status-returned    { background: #fee2e2; color: #991b1b; }
.ace-status-badge.ace-status-delivering, .ace-status-badge.ace-status-shipped     { background: #dbeafe; color: #1e40af; }
.ace-status-badge.ace-status-pending    { background: #fef3c7; color: #92400e; }

/* Progress bar */
.ace-progress-wrap { padding: 20px 20px 10px; }
.ace-progress-track {
    display: flex; align-items: center;
    overflow-x: auto; padding-bottom: 8px;
}
.ace-prog-step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0; min-width: 64px; }
.ace-prog-dot {
    width: 36px; height: 36px;
    border-radius: 50%; background: #f3f4f6; border: 2px solid #e5e7eb;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; transition: all .3s;
}
.ace-prog-step.done .ace-prog-dot  { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.ace-prog-step.active .ace-prog-dot{ background: #4f46e5; border-color: #4f46e5; box-shadow: 0 0 0 4px rgba(79,70,229,.2); }
.ace-prog-lbl { font-size: 11px; color: #9ca3af; text-align: center; }
.ace-prog-step.done .ace-prog-lbl, .ace-prog-step.active .ace-prog-lbl { color: #4f46e5; font-weight: 600; }
.ace-prog-line {
    flex: 1; height: 3px; background: #e5e7eb; min-width: 20px;
    margin: 0 2px; margin-bottom: 20px; transition: background .3s;
}
.ace-prog-line.done { background: #4f46e5; }
.ace-cancel-banner {
    background: #fee2e2; color: #991b1b;
    padding: 12px 20px; font-size: 14px; font-weight: 600;
}

/* Order details */
.ace-order-details { padding: 16px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media(max-width:520px){ .ace-order-details { grid-template-columns: 1fr; } }
.ace-detail-row { background: #f9fafb; border-radius: 8px; padding: 10px 14px; }
.ace-detail-row span { display: block; font-size: 12px; color: #9ca3af; margin-bottom: 3px; }
.ace-detail-row strong { font-size: 14px; color: #1f2937; }
.ace-tracking-code {
    font-family: monospace; font-size: 14px; font-weight: 700;
    color: #4f46e5; background: #ede9fe; padding: 2px 8px; border-radius: 6px;
}
.ace-track-link { font-size: 13px; color: #4f46e5; text-decoration: none; font-weight: 500; }
.ace-track-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════
   AFFILIATE PORTAL - REDESIGNED
═══════════════════════════════════════════ */
.ace-affiliate-portal .ace-portal-cols {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
@media(max-width:640px){ .ace-affiliate-portal .ace-portal-cols { grid-template-columns: 1fr; } }
.ace-form-stack { display: flex; flex-direction: column; gap: 10px; }
.ace-alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin: 4px 0; }
.ace-alert-success { background: #dcfce7; color: #065f46; border: 1px solid #86efac; }
.ace-alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

