/*
 * Reseller portal. It is the SalesOS look: this file only adds what the portal has and the admin screens do not
 * (a top bar without the CRM around it, the booking layout, the parcel journey). Colours, type, buttons, tables,
 * chips, the side drawer and the toast all come from salesos-ui.css, loaded before this file, so a change there
 * reaches the portal too.
 */
body.rp { margin: 0; background: var(--so-bg); min-height: 100vh; -webkit-text-size-adjust: 100%; }
[x-cloak] { display: none !important; }
.rp a { color: inherit; }

/* Top bar */
.rp-top { background: var(--so-surface); border-bottom: 1px solid var(--so-line); position: sticky; top: 0; z-index: 30; }
.rp-top-in { max-width: 1120px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rp-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rp-brand img { width: 32px; height: 32px; border-radius: 6px; flex: none; }
.rp-brand b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-brand small { display: block; font-size: 12px; color: var(--so-muted); }
.rp-top-end { display: flex; align-items: center; gap: 12px; flex: none; }
.rp-bal { text-align: right; line-height: 1.2; }
.rp-bal small { display: block; font-size: 11px; color: var(--so-muted); }
.rp-bal b { font-size: 15px; font-variant-numeric: tabular-nums; }
.rp-bal.neg b { color: var(--so-risk); }
.rp-nav { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.rp-nav .so-tabs { margin: 0; border-bottom: 0; }
.rp-nav .so-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 12px 14px; color: var(--so-muted); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.rp-nav .so-tabs button:hover { color: var(--so-ink); }
.rp-nav .so-tabs button.on { color: var(--so-ink); border-bottom-color: var(--so-accent); }
.rp-nav .so-tabs button .n { margin-left: 4px; font-weight: 400; color: var(--so-muted); font-variant-numeric: tabular-nums; }
.rp-nav .so-tabs button .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--so-warn); margin-left: 6px; vertical-align: middle; }

.rp-main { max-width: 1120px; margin: 0 auto; padding: 16px 16px 96px; }
.rp-title { margin-bottom: 12px; }
.rp-title h1 { font-size: 18px; font-weight: 600; }
.rp-title p { color: var(--so-muted); margin-top: 2px; }
.rp-card { background: var(--so-surface); border: 1px solid var(--so-line); border-radius: var(--so-radius); }
.rp-card + .rp-card { margin-top: 12px; }
.rp-card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--so-line); }
.rp-card-h h2 { font-size: 14px; font-weight: 600; }
.rp-card-b { padding: 16px; }
.rp-note { margin-bottom: 12px; }

/* "Today" list */
.rp-todo { list-style: none; margin: 0; padding: 0; }
.rp-todo li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--so-line); }
.rp-todo li:last-child { border-bottom: 0; }
.rp-todo .ok { color: var(--so-ok); }

/* Orders */
.rp-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.rp-chips button { height: 30px; padding: 0 12px; border: 1px solid var(--so-line-2); border-radius: 999px; background: var(--so-surface); color: var(--so-ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.rp-chips button.on { background: var(--so-accent); border-color: var(--so-accent); color: #fff; }
.rp-chips button .n { margin-left: 4px; opacity: .7; font-variant-numeric: tabular-nums; }
.rp-chips .so-input { margin-left: auto; width: 240px; max-width: 100%; }
.rp-orders tbody tr { cursor: pointer; }
.rp-orders .sub { display: block; font-size: 12px; color: var(--so-muted); }
.rp-orders .st-hint { display: block; font-size: 12px; color: var(--so-muted); margin-top: 2px; max-width: 260px; white-space: normal; }
.rp-so-st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.rp-so-st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--so-line-2); flex: none; }
.rp-so-st.ok { color: var(--so-ok); } .rp-so-st.ok::before { background: var(--so-ok); }
.rp-so-st.warn { color: var(--so-warn); } .rp-so-st.warn::before { background: var(--so-warn); }
.rp-so-st.risk { color: var(--so-risk); } .rp-so-st.risk::before { background: var(--so-risk); }
.rp-so-st.info::before { background: #3b6ea5; }
.rp-com { font-variant-numeric: tabular-nums; font-weight: 600; }
.rp-com small { display: block; font-weight: 400; font-size: 12px; color: var(--so-muted); }
.rp-com.dim { color: var(--so-muted); font-weight: 400; }

/* The parcel's journey */
.rp-steps { list-style: none; margin: 0; padding: 0; }
.rp-steps li { position: relative; padding: 0 0 14px 24px; font-size: 13px; color: var(--so-muted); }
.rp-steps li::before { content: ''; position: absolute; left: 4px; top: 4px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--so-line-2); background: var(--so-surface); }
.rp-steps li::after { content: ''; position: absolute; left: 8px; top: 15px; bottom: -1px; width: 1px; background: var(--so-line-2); }
.rp-steps li:last-child { padding-bottom: 0; }
.rp-steps li:last-child::after { display: none; }
.rp-steps li.done { color: var(--so-ink); } .rp-steps li.done::before { background: var(--so-ok); border-color: var(--so-ok); }
.rp-steps li.current { color: var(--so-ink); font-weight: 600; } .rp-steps li.current::before { border-color: var(--so-accent); background: var(--so-surface); box-shadow: 0 0 0 3px rgba(34, 42, 45, .12); }
.rp-steps li.bad { color: var(--so-warn); font-weight: 600; } .rp-steps li.bad::before { background: var(--so-warn); border-color: var(--so-warn); }
.rp-steps time { display: block; font-weight: 400; font-size: 12px; color: var(--so-muted); }
.rp-events { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.rp-events li { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 4px 0; }
.rp-events time { color: var(--so-muted); font-size: 12px; }

/* Booking */
.rp-book { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.rp-panel { position: sticky; top: 116px; }
.rp-prods { list-style: none; margin: 0; padding: 0; }
.rp-prod { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--so-line); }
.rp-prod:last-child { border-bottom: 0; }
.rp-prod .thumb { width: 48px; height: 48px; border-radius: 6px; background: var(--so-bg); object-fit: cover; display: flex; align-items: center; justify-content: center; color: var(--so-line-2); font-weight: 600; overflow: hidden; }
.rp-prod .thumb img { width: 100%; height: 100%; object-fit: cover; }
.rp-prod .nm { font-weight: 600; line-height: 1.3; }
.rp-prod .meta { font-size: 12px; color: var(--so-muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.rp-prod .meta .free { color: var(--so-ok); }
.rp-prod .pr { text-align: right; white-space: nowrap; }
.rp-prod .pr b { display: block; font-variant-numeric: tabular-nums; }
.rp-prod .pr small { font-size: 12px; color: var(--so-muted); }
.rp-prod .act { margin-top: 6px; display: flex; justify-content: flex-end; }
.rp-qty { display: inline-flex; align-items: center; border: 1px solid var(--so-line-2); border-radius: var(--so-radius); }
.rp-qty button { width: 32px; height: 32px; border: 0; background: none; font-size: 16px; cursor: pointer; color: var(--so-ink); }
.rp-qty button:hover { background: var(--so-bg); }
.rp-qty span { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.rp-line { padding: 10px 0; border-bottom: 1px solid var(--so-line); }
.rp-line:last-child { border-bottom: 0; }
.rp-line .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.rp-line .top b { line-height: 1.3; }
.rp-line .rm { background: none; border: 0; color: var(--so-muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
.rp-line .rm:hover { color: var(--so-risk); }
.rp-line .row { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.rp-line .row .so-input { width: 96px; }
.rp-line .row small { color: var(--so-muted); font-size: 12px; }
.rp-fields { display: grid; gap: 12px; }
.rp-field label { display: block; font-size: 12px; color: var(--so-muted); margin-bottom: 4px; }
.rp-field .so-input, .rp-field .so-select, .rp-field .so-textarea { width: 100%; height: 40px; font-size: 14px; }
.rp-field .so-textarea { height: auto; min-height: 72px; }
.rp-field .help { font-size: 12px; color: var(--so-muted); margin-top: 4px; display: flex; justify-content: space-between; gap: 8px; }
.rp-field .help.bad { color: var(--so-risk); }
.rp-risk { margin-top: 8px; padding: 8px 12px; border-radius: var(--so-radius); background: var(--so-bg); font-size: 13px; }
.rp-risk.ok { background: #ecfdf3; color: var(--so-ok); } .rp-risk.warn { background: var(--so-warn-bg); color: var(--so-warn); } .rp-risk.risk { background: var(--so-risk-bg); color: var(--so-risk); }
.rp-risk small { display: block; opacity: .85; }
.rp-sum { margin-top: 16px; border-top: 1px solid var(--so-line); padding-top: 12px; }
.rp-sum .r { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.rp-sum .r.muted { color: var(--so-muted); }
.rp-sum .r.due { font-size: 17px; font-weight: 600; padding-top: 8px; margin-top: 6px; border-top: 1px solid var(--so-line-2); }
.rp-sum .r.mine { color: var(--so-ok); font-weight: 600; }
.rp-sum .r.mine small { display: block; font-weight: 400; color: var(--so-muted); font-size: 12px; text-align: right; }
.rp-sum .fine { font-size: 12px; color: var(--so-muted); margin-top: 8px; }
.rp-go { width: 100%; margin-top: 12px; height: 44px; font-size: 15px; justify-content: center; }
.rp-done { text-align: center; padding: 32px 16px; }
.rp-done .tick { width: 44px; height: 44px; border-radius: 50%; background: #ecfdf3; color: var(--so-ok); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 8px; }
.rp-done h2 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.rp-done .acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* Confirm dialog */
.rp-modal-bd { position: fixed; inset: 0; background: rgba(15, 20, 22, .35); z-index: 1060; display: flex; align-items: center; justify-content: center; padding: 16px; }
.rp-modal { background: var(--so-surface); border-radius: 8px; width: min(440px, 100%); max-height: 92vh; overflow-y: auto; }
.rp-modal h2 { font-size: 16px; font-weight: 600; padding: 16px 16px 0; }
.rp-modal .b { padding: 12px 16px; }
.rp-modal .f { display: flex; gap: 8px; padding: 12px 16px 16px; }
.rp-modal .f .so-btn { flex: 1; justify-content: center; height: 40px; }

/* Phone: the order form follows the list, with a bar to reach it */
.rp-cartbar { display: none; }
@media (max-width: 860px) {
    .rp-book { grid-template-columns: minmax(0, 1fr); }
    .rp-panel { position: static; }
    .rp-cartbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 10px 16px; background: var(--so-surface); border-top: 1px solid var(--so-line); }
    .rp-cartbar .so-btn { width: 100%; height: 44px; justify-content: space-between; font-size: 14px; }
    .rp-bal.hide-sm small { display: none; }
    .rp-chips .so-input { margin-left: 0; width: 100%; }
    .rp-orders .hide-sm { display: none; }
}

/* Sign in / sign up */
.rp-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.rp-auth-in { width: 100%; max-width: 400px; }
.rp-auth-brand { text-align: center; margin-bottom: 20px; }
.rp-auth-brand img { width: 48px; height: 48px; border-radius: 10px; }
.rp-auth-brand h1 { font-size: 18px; font-weight: 600; margin-top: 10px; }
.rp-auth-brand p { color: var(--so-muted); margin-top: 2px; }
.rp-auth .rp-card-b { padding: 20px; }
.rp-auth .so-btn.primary { width: 100%; height: 44px; justify-content: center; font-size: 15px; }
.rp-auth .alt { text-align: center; color: var(--so-muted); margin-top: 16px; }
.rp-auth .alt a { color: var(--so-ink); font-weight: 600; }
.rp-pw { position: relative; }
.rp-pw .so-input { padding-right: 64px; }
.rp-pw button { position: absolute; right: 4px; top: 4px; height: 32px; border: 0; background: none; color: var(--so-muted); font: inherit; font-size: 13px; cursor: pointer; padding: 0 10px; }
.rp-pw button:hover { color: var(--so-ink); }
.rp-err { background: var(--so-risk-bg); color: #7a271a; border-radius: var(--so-radius); padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.rp-ok { background: #ecfdf3; color: var(--so-ok); border-radius: var(--so-radius); padding: 12px; font-size: 14px; }
@media (min-width: 861px) { .rp-auth .rp-field .so-input { height: 40px; } }
.rp-empty { padding: 40px 16px; text-align: center; color: var(--so-muted); }
.rp-empty strong { display: block; color: var(--so-ink); font-size: 15px; margin-bottom: 4px; }
