/* Style Nest reseller portal. Palette: plum (brand), marigold (warmth), jade (money in), ruby (money out).
   Mobile first: everything is designed for a phone in Chrome, then widens for desktop. */
:root {
  --plum-900: #2E1030; --plum-800: #3D1740; --plum-700: #4A1D4A; --plum-600: #62285F; --plum-100: #EFE3EF; --plum-50: #F8F1F8;
  --gold: #E8A33D; --gold-soft: #FBEBD0;
  --jade: #1B7A57; --jade-bg: #E4F4EC; --ruby: #B3273D; --ruby-bg: #FBE7EA; --amber: #9A6200; --amber-bg: #FFF1D6; --blue: #1E5AA8; --blue-bg: #E4EEFB;
  --ink: #241629; --muted: #6E5D72; --line: #E6DBE7; --paper: #FCFAFD; --card: #FFFFFF;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(46, 16, 48, .06), 0 6px 18px -8px rgba(46, 16, 48, .18);
  --font: 'Nunito Sans', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--paper); min-height: 100vh; min-height: 100dvh; }
body.noscroll { overflow: hidden; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .6rem; }
a { color: var(--plum-600); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: .86rem; } .tiny { font-size: .78rem; }
.pos { color: var(--jade); } .neg { color: var(--ruby); } .zero { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; } .row.gap { gap: .6rem; } .row.between { justify-content: space-between; } .row.end { justify-content: flex-end; } .row.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: .9rem; } .grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 46px; padding: 0 1.15rem; border-radius: 12px; border: 1.5px solid transparent; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .08s, background .15s; user-select: none; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--plum-700); color: #fff; } .btn.primary:hover { background: var(--plum-600); }
.btn.gold { background: var(--gold); color: #3a2200; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--plum-700); } .btn.ghost:hover { background: var(--plum-50); }
.btn.danger { background: var(--ruby); color: #fff; }
.btn.good { background: var(--jade); color: #fff; }
.btn.block { width: 100%; } .btn.sm { min-height: 36px; padding: 0 .8rem; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.ghost.is-busy::after { border-color: var(--line); border-top-color: var(--plum-700); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--plum-50); color: var(--plum-700); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.link-btn { background: none; border: 0; padding: 0; color: var(--plum-600); font-weight: 700; text-decoration: underline; cursor: pointer; }

/* forms */
.field { display: block; } .field + .field { margin-top: .85rem; }
.field-label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: .25rem; }
.field-hint { display: block; font-size: .8rem; color: var(--muted); margin-top: .2rem; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 48px; padding: .6rem .85rem; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--plum-600); outline: none; box-shadow: 0 0 0 3px rgba(98, 40, 95, .15); }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--plum-700); flex: none; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .93rem; }
.err { background: var(--ruby-bg); color: var(--ruby); border-radius: 10px; padding: .6rem .8rem; font-size: .93rem; font-weight: 600; }
.ok-box { background: var(--jade-bg); color: var(--jade); border-radius: 10px; padding: .7rem .9rem; font-weight: 600; }
.note { background: var(--gold-soft); border-radius: 10px; padding: .6rem .85rem; font-size: .9rem; color: #5a3a00; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 1.3rem 0 .6rem; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .65rem; border-radius: 99px; font-size: .78rem; font-weight: 800; white-space: nowrap; background: var(--plum-50); color: var(--plum-700); }
.pill.delivered, .pill.good { background: var(--jade-bg); color: var(--jade); }
.pill.returned, .pill.failed, .pill.bad { background: var(--ruby-bg); color: var(--ruby); }
.pill.transit, .pill.active { background: var(--blue-bg); color: var(--blue); }
.pill.pending, .pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.cancelled, .pill.rejected, .pill.suspended { background: #ECE7EE; color: #5b4f5f; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--plum-900); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; font-weight: 700; max-width: min(92vw, 460px); opacity: 0; pointer-events: none; transition: .22s; z-index: 300; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.good { background: var(--jade); } .toast.bad { background: var(--ruby); }

/* modal */
.backdrop { position: fixed; inset: 0; background: rgba(36, 22, 41, .55); z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 22px 22px 0 0; padding: 1rem 1.1rem calc(1.2rem + var(--safe-b)); animation: rise .22s ease-out; }
.sheet.wide { max-width: 720px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; gap: .6rem; }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 720px) { .backdrop { align-items: center; } .sheet { border-radius: 20px; } }

.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 1.1rem; margin-bottom: .3rem; }
.skeleton { background: linear-gradient(90deg, #f0e8f1 25%, #f8f2f9 37%, #f0e8f1 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* shared by reseller app and admin */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: .3rem .8rem; font-size: .93rem; margin: 0; } .kv dt { color: var(--muted); font-weight: 700; } .kv dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 .3rem; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid var(--line); margin-left: .3rem; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--line); border: 2px solid #fff; }
.timeline li:first-child::before { background: var(--plum-700); } .timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.tn-big { font-family: ui-monospace, Menlo, monospace; font-size: 1.35rem; font-weight: 800; letter-spacing: .04em; background: var(--plum-50); border-radius: 12px; padding: .7rem; margin: .6rem 0; word-break: break-all; }
.line { display: flex; gap: .7rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line); } .line:last-child { border-bottom: 0; }
.sum-row { display: flex; justify-content: space-between; padding: .28rem 0; font-size: .96rem; }
.outcome { border-radius: 12px; padding: .65rem .75rem; } .outcome b { display: block; font-size: 1.15rem; font-family: var(--display); } .outcome span { font-size: .78rem; font-weight: 700; }
.outcome.win { background: var(--jade-bg); color: var(--jade); } .outcome.lose { background: var(--ruby-bg); color: var(--ruby); }
