/* Addyson Trade Portal — front-end (mobile-first) */
.atp-portal { max-width: 640px; margin: 0 auto; padding: 8px; font-size: 16px; line-height: 1.5; color: #1f2937; }
.atp-portal h3 { margin: 0 0 6px; font-size: 20px; }
.atp-portal h4 { margin: 0 0 8px; font-size: 17px; }
.atp-muted { color: #6b7280; }
.atp-hint { color: #6b7280; font-size: 14px; }
.atp-link { color: #2563eb; text-decoration: underline; }

.atp-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.atp-tab { flex: 1; padding: 12px; border: 1px solid #d1d5db; background: #f9fafb; border-radius: 10px; font-size: 16px; cursor: pointer; }
.atp-portal .atp-tab,
.atp-portal .atp-tab:not(.is-active) { color: #1f2937 !important; }
.atp-tab.is-active { background: #2563eb; color: #fff !important; border-color: #2563eb; }

.atp-pane { display: flex; flex-direction: column; gap: 12px; }
.atp-pane[hidden] { display: none; }
.atp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.atp-stat { background: #f8fafc; border: 1px solid #eef2f7; border-radius: 12px; padding: 12px; text-align: center; }
.atp-stat__n { font-size: 22px; font-weight: 700; color: #111827; }
.atp-stat__l { font-size: 12px; color: #6b7280; }
.atp-f { display: flex; flex-direction: column; gap: 4px; }
.atp-f > span { font-size: 14px; color: #374151; }
.atp-f input { width: 100%; padding: 12px; font-size: 16px; border: 1px solid #d1d5db; border-radius: 10px; box-sizing: border-box; }
.atp-f input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.atp-btn { display: inline-block; width: 100%; text-align: center; padding: 14px 18px; font-size: 16px; font-weight: 600; line-height: 1.2; border: 1px solid #cbd5e1; background: #fff; color: #1f2937 !important; border-radius: 10px; cursor: pointer; text-decoration: none; }
.atp-btn:hover { background: #f8fafc; }
.atp-btn--primary { background: #2563eb; color: #fff !important; border-color: #2563eb; }
.atp-btn--primary:hover { background: #1d4ed8; }
.atp-btn[disabled] { opacity: .55; cursor: not-allowed; }
.atp-msg { min-height: 20px; font-size: 14px; margin: 0; }

.atp-note { padding: 16px; border-radius: 12px; background: #f3f4f6; }
.atp-note--info { background: #eff6ff; border: 1px solid #bfdbfe; }
.atp-note--warn { background: #fef2f2; border: 1px solid #fecaca; }

.atp-home__bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.atp-card2 { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.atp-pricetable { width: 100%; border-collapse: collapse; font-size: 15px; }
.atp-pricetable th, .atp-pricetable td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #f1f5f9; }
.atp-pricetable th:last-child, .atp-pricetable td:last-child { text-align: right; }

/* Credit limit bar */
.atp-credit { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.atp-credit__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.atp-credit__label { font-weight: 600; font-size: 14px; color: #374151; }
.atp-credit__vals { font-size: 14px; color: #6b7280; }
.atp-credit__track { height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.atp-credit__fill { height: 100%; border-radius: 99px; transition: width .3s; }

/* Over-limit grace note */
.atp-grace-note { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; background: #f0fdf4; border: 1px solid #86efac; border-radius: 8px; font-size: 14px; color: #166534; }
.atp-grace-note__icon { font-size: 12px; flex-shrink: 0; }

/* Reward credit badge */
.atp-reward-badge { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; background: #fefce8; border: 1px solid #fde047; border-radius: 8px; font-size: 14px; color: #713f12; }
.atp-reward-badge__icon { font-size: 18px; color: #ca8a04; flex-shrink: 0; }

/* Decline a quoted order */
.atp-decline { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e5e7eb; }
.atp-decline-link { background: none; border: none; color: #dc2626; font-size: 14px; cursor: pointer; padding: 0; text-decoration: underline; }
.atp-decline-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.atp-decline-form[hidden] { display: none; }
.atp-decline-reason { flex: 1; min-width: 180px; padding: 10px; font-size: 15px; border: 1px solid #d1d5db; border-radius: 8px; }
.atp-decline-confirm { width: auto; padding: 10px 16px; font-size: 14px; border-color: #dc2626; color: #dc2626 !important; }

/* Pay balance */
.atp-balance-pay { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.atp-balance-pay .atp-btn { width: 100%; }
.atp-balance-area { margin-top: 10px; }
.atp-balance-msg { min-height: 18px; font-size: 14px; margin: 6px 0 0; }

/* Order builder */
.atp-row { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.atp-row__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 8px; }
.atp-row__grid select, .atp-row__grid input { width: 100%; padding: 10px; font-size: 16px; border: 1px solid #d1d5db; border-radius: 8px; box-sizing: border-box; }
.atp-o-add { margin-bottom: 12px; }
.atp-o-out { margin-top: 14px; }
.atp-quotebox { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 12px; padding: 16px; text-align: center; }
.atp-price { font-size: 30px; font-weight: 700; color: #075985; }
.atp-quotebox .atp-btn { margin-top: 10px; }
.atp-pay-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.atp-pay-area { margin-top: 12px; }
#atp-sumup-card { margin-top: 8px; }

/* Stepped upload order form */
.atp-step { display: flex; gap: 12px; align-items: flex-start; background: #f8fafc; border: 1px solid #eef2f7; border-radius: 12px; padding: 14px; margin: 12px 0; }
.atp-step__n { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; background: #2563eb; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.atp-step__b { flex: 1; min-width: 0; }
.atp-step__t { font-weight: 600; font-size: 16px; }
.atp-dl { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; background: #fff; border: 1px solid #2563eb; color: #2563eb; margin-top: 6px; }
.atp-dl:hover { background: #eff6ff; }
.atp-i { font-size: 18px; line-height: 1; }
.atp-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; border: 2px dashed #cbd5e1; border-radius: 12px; padding: 22px 14px; cursor: pointer; background: #fff; margin-top: 6px; }
.atp-drop:hover { border-color: #2563eb; background: #f8fbff; }
.atp-drop__icon { font-size: 34px; line-height: 1; }
.atp-drop__t { font-weight: 600; color: #334155; }
.atp-drop__list { font-size: 13px; color: #2563eb; word-break: break-word; }
.atp-btn--lg { width: 100%; padding: 16px; font-size: 17px; margin-top: 8px; }
.atp-tick { font-size: 40px; color: #16a34a; text-align: center; line-height: 1; margin-bottom: 6px; }
.atp-o-material { font-size: 16px; padding: 12px; border-radius: 10px; }
.atp-lead-note { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 15px; }

/* Order tracker (Domino's-style) */
.atp-track { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px 18px; }
.atp-track__steps { margin-top: 14px; }
.atp-track__step { display: flex; gap: 14px; align-items: flex-start; position: relative; padding-bottom: 18px; }
.atp-track__step:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 30px; bottom: 0; width: 2px; background: #e5e7eb; }
.atp-track__step.done:not(:last-child)::before { background: #16a34a; }
.atp-track__dot { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; border: 2px solid #cbd5e1; background: #fff; color: #94a3b8; display: flex; align-items: center; justify-content: center; font-size: 15px; z-index: 1; }
.atp-track__step.done .atp-track__dot { background: #16a34a; border-color: #16a34a; color: #fff; }
.atp-track__step.current .atp-track__dot { background: #2563eb; border-color: #2563eb; color: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.15); }
.atp-track__t { font-weight: 600; font-size: 16px; }
.atp-track__s { font-size: 13px; color: #6b7280; }
.atp-track__step.future .atp-track__t { color: #9ca3af; font-weight: 400; }
.atp-drop--mini { padding: 12px; border-style: solid; border-color: #e5e7eb; }
.atp-drop--mini .atp-drop__t { font-weight: 400; color: #6b7280; font-size: 14px; }

/* Upload thumbnails */
.atp-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.atp-thumb { position: relative; width: 76px; height: 76px; flex: 0 0 76px; }
.atp-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 2px solid #e5e7eb; display: block; }
.atp-thumb__rm { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; background: #ef4444; color: #fff !important; border: 2px solid #fff; font-size: 15px; line-height: 1; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
.atp-add-more { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e5e7eb; }
.atp-upload-row { display: flex; gap: 8px; margin-top: 8px; }
.atp-upload-btn { flex: 1; cursor: pointer; width: auto; }

/* OCR review table */
.atp-review { overflow-x: auto; margin-top: 10px; }
.atp-rt { width: 100%; border-collapse: collapse; font-size: 15px; }
.atp-rt th { text-align: left; padding: 5px 4px; font-size: 12px; color: #6b7280; border-bottom: 2px solid #e5e7eb; white-space: nowrap; }
.atp-rt td { padding: 3px 4px; border-bottom: 1px solid #f1f5f9; }
.atp-rt input[type="number"] { width: 80px; padding: 6px 6px; font-size: 15px; border: 1px solid #d1d5db; border-radius: 6px; box-sizing: border-box; }
.atp-rt select { width: 90px; padding: 6px 4px; font-size: 14px; border: 1px solid #d1d5db; border-radius: 6px; }
.atp-rt__low input, .atp-rt__low select { border-color: #f59e0b; background: #fffbeb; }
.atp-rt__from { font-size: 12px; color: #6b7280; white-space: nowrap; }
.atp-rt__low .atp-rt__from { color: #b45309; font-weight: 600; }
.atp-rt__rm { background: none; border: none; color: #9ca3af; font-size: 18px; line-height: 1; cursor: pointer; padding: 4px 6px; }
.atp-rt__rm:hover { color: #ef4444; }
.atp-rt__add { width: 100%; margin-top: 8px; background: #f9fafb; border: 1px dashed #d1d5db; color: #374151; padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 400; }
.atp-quotebox--review { text-align: left; }

/* Admin preview banner */
.atp-preview-bar { background: #1E2A52; color: #fff; padding: 10px 16px; font-size: 14px; display: flex; align-items: center; gap: 12px; margin-bottom: 16px; border-radius: 8px; }
.atp-preview-back { color: #93c5fd; font-weight: 600; text-decoration: none; margin-left: auto; white-space: nowrap; }
.atp-preview-back:hover { text-decoration: underline; }

.atp-err { color: #b91c1c; }
.atp-ostatus { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: #e5e7eb; color: #374151; white-space: nowrap; }
.atp-ostatus--new { background: #dbeafe; color: #1e40af; }
.atp-ostatus--in_production { background: #fef9c3; color: #854d0e; }
.atp-ostatus--ready { background: #dbeafe; color: #1d4ed8; }
.atp-ostatus--collected { background: #dcfce7; color: #166534; }
.atp-ostatus--cancelled { background: #fee2e2; color: #991b1b; }

/* Outstanding stat highlight */
.atp-stat--warn .atp-stat__n { color: #dc2626; }
.atp-stat--warn .atp-stat__l { color: #dc2626; }

/* Order history filters */
.atp-oh-filters { margin: 14px 0 10px; display: flex; flex-direction: column; gap: 10px; }
.atp-oh-search { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; outline: none; }
.atp-oh-search:focus { border-color: #4F7CC4; box-shadow: 0 0 0 3px rgba(79,124,196,.12); }
.atp-oh-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.atp-oh-pill { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 999px; padding: 4px 14px; font-size: 13px; color: #475569; cursor: pointer; transition: all .15s; }
.atp-oh-pill:hover { background: #e2e8f0; }
.atp-oh-pill.is-active { background: #1E2A52; border-color: #1E2A52; color: #fff; }
.atp-oh-pill--alert { background: #fef9c3; border-color: #fde047; color: #854d0e; font-weight: 600; }
.atp-oh-pill--alert.is-active { background: #1E2A52; border-color: #1E2A52; color: #fff; }

/* Paid column */
.atp-paid-yes { font-size: 13px; color: #166534; font-weight: 600; }
.atp-paid-no  { font-size: 13px; color: #dc2626; }
.atp-pricetable td:last-child, .atp-pricetable th:last-child { text-align: left; }

/* Sending spinner + progress bar */
.atp-loading { text-align: center; padding: 24px 16px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; }
.atp-spinner { width: 38px; height: 38px; margin: 0 auto 12px; border: 4px solid #dbeafe; border-top-color: #2563eb; border-radius: 50%; animation: atp-spin .8s linear infinite; }
@keyframes atp-spin { to { transform: rotate(360deg); } }
.atp-loading__t { font-weight: 600; font-size: 16px; margin: 0 0 10px; color: #1f2937; }
.atp-loading__s { margin: 8px 0 0; }
.atp-prog { height: 10px; background: #e5e7eb; border-radius: 99px; overflow: hidden; max-width: 320px; margin: 0 auto; }
.atp-prog__fill { height: 100%; background: #2563eb; border-radius: 99px; transition: width .2s; }
.atp-prog--busy .atp-prog__fill { width: 100% !important; background: linear-gradient(90deg, #2563eb 25%, #93c5fd 50%, #2563eb 75%); background-size: 200% 100%; animation: atp-prog-slide 1.2s linear infinite; }
@keyframes atp-prog-slide { from { background-position: 200% 0; } to { background-position: 0 0; } }

/* No-reference nudge */
.atp-ref-ask { background: #fffbeb; border: 1px solid #fcd34d; border-radius: 10px; padding: 14px; font-size: 15px; color: #713f12; }
.atp-ref-ask__btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.atp-ref-ask__btns .atp-btn { width: auto; padding: 10px 16px; font-size: 14px; }

/* Order reference line */
.atp-oh-ref { font-size: 12px; color: #4F7CC4; font-weight: 600; word-break: break-word; }

/* No-results row */
.atp-oh-empty { margin-top: 12px; }
@media (min-width: 560px) { .atp-row__grid { grid-template-columns: repeat(4, 1fr); } }

/* Over-limit ordering block */
.atp-overblock { border: 2px solid #fca5a5; background: #fff8f8; }
.atp-overblock h4 { color: #991b1b; }
.atp-overblock .atp-balance-pay { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* Account locked (over limit) — blur everything except the lock card */
.atp-home--locked > *:not(.atp-lockcard) { filter: blur(5px); pointer-events: none; user-select: none; }
.atp-lockcard { background: #fff; border: 2px solid #fca5a5; border-radius: 14px; padding: 22px 18px; margin-bottom: 18px; text-align: center; }
.atp-lockcard__icon { font-size: 34px; line-height: 1; margin-bottom: 8px; }
.atp-lockcard h3 { margin: 0 0 8px; color: #991b1b; }
.atp-lockcard p { margin: 0 0 10px; font-size: 15px; }
.atp-lockcard .atp-balance-pay { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
