/* ------------------------------------------------------------------
   In-store refund system
   ------------------------------------------------------------------ */

:root {
	--ink:        #14181f;
	--ink-soft:   #5a6472;
	--ink-faint:  #8b95a3;
	--line:       #e2e6ec;
	--line-soft:  #eef1f5;
	--paper:      #ffffff;
	--canvas:     #f4f6f9;

	--brand:      #1f4fd8;
	--brand-dark: #163ba6;
	--brand-wash: #eef3ff;

	--ok:         #12805c;
	--ok-wash:    #e6f6f0;
	--warn:       #a76a00;
	--warn-wash:  #fdf3e2;
	--bad:        #c0362c;
	--bad-wash:   #fdecea;

	--radius:     10px;
	--radius-lg:  14px;
	--shadow:     0 1px 2px rgba(20, 24, 31, .06), 0 4px 16px rgba(20, 24, 31, .06);
	--shadow-lg:  0 8px 32px rgba(20, 24, 31, .12);

	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The UA rule for [hidden] is a bare element selector, so any class that sets
   display beats it - .btn[hidden] stayed on screen. Everything that toggles
   .hidden from script depends on this. */
[hidden] { display: none !important; }

body {
	margin: 0;
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.55;
	color: var(--ink);
	background: var(--canvas);
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p  { margin: 0 0 1em; }
a  { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted     { color: var(--ink-soft); }
.faint     { color: var(--ink-faint); }
.small     { font-size: .86rem; }
.tiny      { font-size: .78rem; }
.strong    { font-weight: 650; }
.mono      { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap    { white-space: nowrap; }
.right     { text-align: right; }
.center    { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .pt-0 { padding-top: 0; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }

/* ---------------------------------------------------------- buttons */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .45rem;
	padding: .6rem 1.05rem;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: var(--brand);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover     { background: var(--brand-dark); text-decoration: none; }
.btn:active    { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-ghost   { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-soft); }
.btn-ok      { background: var(--ok); }
.btn-ok:hover{ background: #0d6448; }
.btn-bad     { background: var(--bad); }
.btn-bad:hover { background: #a12b23; }
.btn-sm      { padding: .38rem .7rem; font-size: .86rem; }
.btn-lg      { padding: .9rem 1.6rem; font-size: 1.05rem; }
.btn-block   { width: 100%; }

/* ------------------------------------------------------------ forms */

label, .label {
	display: block;
	font-size: .82rem;
	font-weight: 600;
	color: var(--ink-soft);
	margin-bottom: .3rem;
	letter-spacing: .01em;
}

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=date], input[type=search], select, textarea {
	width: 100%;
	padding: .62rem .75rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--paper);
	font: inherit;
	color: var(--ink);
	transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--brand);
	box-shadow: 0 0 0 3px var(--brand-wash);
}
textarea { min-height: 96px; resize: vertical; }
select   { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%235a6472' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; background-size: 11px; padding-right: 2rem; }

.field      { margin-bottom: 1.05rem; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--bad); }
.field-msg  { margin-top: .3rem; font-size: .8rem; color: var(--bad); }
.field-hint { margin-top: .3rem; font-size: .8rem; color: var(--ink-faint); }
.req        { color: var(--bad); }

.check { display: flex; align-items: flex-start; gap: .6rem; }
.check input { width: 18px; height: 18px; margin: .15rem 0 0; flex: none; accent-color: var(--brand); }
.check label { margin: 0; font-weight: 500; font-size: .92rem; color: var(--ink); }

.grid    { display: grid; gap: 0 1rem; }
.grid-2  { grid-template-columns: 1fr 1fr; }
.grid-3  { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ cards */

.card {
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
	margin-bottom: 1.25rem;
}
.card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .95rem 1.25rem;
	border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { margin: 0; }

/* Destructive corner of a page - deleting a return */
.card-danger { border-color: var(--bad); }
.card-danger .card-head { border-bottom-color: var(--bad); }
.card-danger .card-head h3 { color: var(--bad); }
.card-body { padding: 1.25rem; }
.card-body > :last-child { margin-bottom: 0; }
.card-foot {
	padding: .9rem 1.25rem;
	border-top: 1px solid var(--line-soft);
	background: #fbfcfd;
	border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ----------------------------------------------------------- alerts */

.alert {
	padding: .8rem 1rem;
	border-radius: var(--radius);
	border: 1px solid transparent;
	margin-bottom: 1.1rem;
	font-size: .92rem;
}
.alert-ok  { background: var(--ok-wash);  border-color: #b7e3d2; color: #0b5540; }
.alert-bad { background: var(--bad-wash); border-color: #f3c3be; color: #8f2a22; }
.alert-warn{ background: var(--warn-wash);border-color: #f0d9ac; color: #7a4d00; }
.alert ul  { margin: .4rem 0 0; padding-left: 1.1rem; }

/* ----------------------------------------------------------- badges */

.badge {
	display: inline-block;
	padding: .22rem .6rem;
	border-radius: 999px;
	font-size: .76rem;
	font-weight: 650;
	letter-spacing: .01em;
	white-space: nowrap;
}
.badge-pending  { background: var(--warn-wash); color: var(--warn); }
.badge-approved { background: var(--brand-wash); color: var(--brand-dark); }
.badge-complete { background: var(--ok-wash);   color: var(--ok); }
.badge-rejected { background: var(--bad-wash);  color: var(--bad); }
.badge-role     { background: var(--line-soft); color: var(--ink-soft); }

/* ----------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table.data {
	width: 100%;
	border-collapse: collapse;
	font-size: .9rem;
}
table.data th {
	text-align: left;
	font-size: .76rem;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--ink-faint);
	font-weight: 650;
	padding: .7rem 1rem;
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
}
table.data td {
	padding: .8rem 1rem;
	border-bottom: 1px solid var(--line-soft);
	vertical-align: middle;
}
table.data tbody tr:hover { background: #fafbfd; }
table.data tbody tr:last-child td { border-bottom: none; }

.empty {
	padding: 3rem 1.5rem;
	text-align: center;
	color: var(--ink-faint);
}
.empty-icon { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .55; }

/* -------------------------------------------------------- admin shell */

.shell { display: flex; min-height: 100vh; }

.sidebar {
	width: 232px;
	flex: none;
	background: #10151d;
	color: #aeb8c6;
	display: flex;
	flex-direction: column;
	position: sticky;
	top: 0;
	height: 100vh;
}
.sidebar-brand {
	padding: 1.15rem 1.25rem;
	border-bottom: 1px solid rgba(255,255,255,.08);
	color: #fff;
	font-weight: 650;
	letter-spacing: -.01em;
}
.sidebar-brand span { display: block; font-size: .72rem; font-weight: 500; color: #7b8798; letter-spacing: .03em; }
.sidebar nav { padding: .75rem .6rem; flex: 1; overflow-y: auto; }
.sidebar nav a {
	display: flex;
	align-items: center;
	gap: .6rem;
	padding: .55rem .7rem;
	border-radius: 8px;
	color: #aeb8c6;
	font-size: .92rem;
	font-weight: 500;
	margin-bottom: .12rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.on    { background: var(--brand); color: #fff; }
.sidebar nav .sep {
	margin: .9rem .7rem .4rem;
	font-size: .68rem;
	text-transform: uppercase;
	letter-spacing: .07em;
	color: #5d6879;
}
.sidebar nav .count {
	margin-left: auto;
	background: rgba(255,255,255,.14);
	border-radius: 999px;
	padding: .05rem .45rem;
	font-size: .74rem;
	font-weight: 650;
}
.sidebar nav a.on .count { background: rgba(0,0,0,.22); }
.sidebar-foot {
	padding: .85rem 1.25rem;
	border-top: 1px solid rgba(255,255,255,.08);
	font-size: .82rem;
}
.sidebar-foot .who { color: #fff; font-weight: 600; }
.sidebar-foot a { color: #8b95a3; }

.main { flex: 1; min-width: 0; }
.topbar {
	background: var(--paper);
	border-bottom: 1px solid var(--line);
	padding: .9rem 1.75rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	position: sticky;
	top: 0;
	z-index: 5;
}
.topbar h1 { font-size: 1.15rem; margin: 0; }
.content { padding: 1.75rem; max-width: 1240px; }

.menu-toggle { display: none; }

@media (max-width: 900px) {
	.sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
	.shell.open .sidebar { transform: none; }
	.menu-toggle { display: inline-flex; }
	.content { padding: 1.1rem; }
	.topbar { padding: .8rem 1.1rem; }
}

/* --------------------------------------------------------- stat tiles */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: .85rem; margin-bottom: 1.5rem; }
.tile {
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	padding: 1rem 1.1rem;
	box-shadow: var(--shadow);
	display: block;
	color: inherit;
}
.tile:hover { text-decoration: none; border-color: #cfd7e2; }
.tile .n { font-size: 1.75rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }
.tile .k { font-size: .78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-top: .2rem; }
.tile.is-mine { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.tile.warn .n { color: var(--warn); }
.tile.ok   .n { color: var(--ok); }
.tile.bad  .n { color: var(--bad); }

/* ---------------------------------------------------- progress tracker */

.tracker {
	display: flex;
	align-items: flex-start;
	gap: 0;
	padding: 1.5rem 1.25rem .5rem;
	overflow-x: auto;
}
.tracker .step { flex: 1 1 0; min-width: 108px; text-align: center; position: relative; }
.tracker .step::before,
.tracker .step::after {
	content: "";
	position: absolute;
	top: 15px;
	height: 2px;
	background: var(--line);
	width: 50%;
}
.tracker .step::before { left: 0; }
.tracker .step::after  { right: 0; }
.tracker .step:first-child::before,
.tracker .step:last-child::after { display: none; }
.tracker .step.done::before,
.tracker .step.done::after,
.tracker .step.current::before { background: var(--ok); }
.tracker .step.rejected::before { background: var(--bad); }

.tracker .dot {
	position: relative;
	z-index: 1;
	width: 32px;
	height: 32px;
	margin: 0 auto .5rem;
	border-radius: 50%;
	background: var(--paper);
	border: 2px solid var(--line);
	color: var(--ink-faint);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: .85rem;
	font-weight: 700;
}
.tracker .step.done .dot     { background: var(--ok); border-color: var(--ok); color: #fff; }
.tracker .step.current .dot  { background: var(--paper); border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-wash); }
.tracker .step.rejected .dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.tracker .step .name { font-size: .82rem; font-weight: 600; }
.tracker .step.upcoming .name { color: var(--ink-faint); font-weight: 500; }
.tracker .step .when { font-size: .72rem; color: var(--ink-faint); margin-top: .1rem; }
.tracker .step.current .name { color: var(--brand); }
.tracker .step.rejected .name { color: var(--bad); }

.tracker-note {
	margin: 0 1.25rem 1.25rem;
	padding: .7rem .9rem;
	border-radius: var(--radius);
	font-size: .88rem;
}

/* ---------------------------------------------------------- detail dl */

.dl { display: grid; grid-template-columns: 190px 1fr; gap: .1rem 1rem; }
.dl dt { font-size: .8rem; color: var(--ink-soft); font-weight: 600; padding: .45rem 0; }
.dl dd { margin: 0; padding: .45rem 0; border-bottom: 1px solid var(--line-soft); }
.dl dt { border-bottom: 1px solid var(--line-soft); }
.dl > :nth-last-child(-n+2) { border-bottom: none; }
@media (max-width: 620px) {
	.dl { grid-template-columns: 1fr; gap: 0; }
	.dl dt { padding-bottom: 0; border: none; }
	.dl dd { padding-top: .1rem; }
}

/* ------------------------------------------------------------ timeline */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.6rem; }
.timeline li::before {
	content: "";
	position: absolute;
	left: 3px; top: 6px;
	width: 9px; height: 9px;
	border-radius: 50%;
	background: var(--brand);
}
.timeline li::after {
	content: "";
	position: absolute;
	left: 7px; top: 18px; bottom: 0;
	width: 1px;
	background: var(--line);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline li.approved::before  { background: var(--ok); }
.timeline li.rejected::before,
.timeline li.sent_back::before { background: var(--bad); }
.timeline li.submitted::before { background: var(--ink-soft); }
.timeline li.completed::before { background: var(--ok); }
.timeline li.deleted::before   { background: var(--bad); }
.timeline li.restored::before  { background: var(--ink-soft); }
.timeline .t-head { font-size: .92rem; font-weight: 600; }
.timeline .t-meta { font-size: .78rem; color: var(--ink-faint); }
.timeline .t-note {
	margin-top: .35rem;
	padding: .5rem .7rem;
	background: var(--canvas);
	border-radius: 8px;
	font-size: .87rem;
}

/* ------------------------------------------------------------- toolbar */

.toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: .7rem;
	margin-bottom: 1.15rem;
}
.toolbar .field { margin: 0; }
.toolbar .grow  { flex: 1 1 200px; }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip {
	padding: .32rem .75rem;
	border-radius: 999px;
	border: 1px solid var(--line);
	background: var(--paper);
	font-size: .84rem;
	font-weight: 550;
	color: var(--ink-soft);
}
.chip:hover { text-decoration: none; border-color: #cfd7e2; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ============================================================ PUBLIC ===
   Store terminal + customer form
   ====================================================================== */

.public-wrap {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	background: linear-gradient(170deg, #f7f9fc 0%, #eef2f8 100%);
}
.public-card {
	width: 100%;
	max-width: 460px;
	background: var(--paper);
	border-radius: 16px;
	box-shadow: var(--shadow-lg);
	padding: 1.75rem;
}
.public-card.wide { max-width: 640px; }
.public-head { text-align: center; margin-bottom: 1.5rem; }
.public-head .eyebrow {
	font-size: .74rem;
	text-transform: uppercase;
	letter-spacing: .1em;
	color: var(--brand);
	font-weight: 700;
}
.public-head h1 { margin: .3rem 0 .25rem; font-size: 1.4rem; }
.public-head p  { margin: 0; color: var(--ink-soft); font-size: .92rem; }

/* OTP entry */
.otp-input {
	font-size: 2rem !important;
	letter-spacing: .55em;
	text-align: center;
	font-weight: 650;
	padding: .7rem .5rem .7rem 1.05rem !important;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Terminal */
.terminal-wrap {
	min-height: 100vh;
	background: #10151d;
	color: #e8edf4;
	padding: 1.5rem;
}
.terminal-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	max-width: 1000px;
	margin: 0 auto 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid rgba(255,255,255,.1);
}
.terminal-bar .store-name { font-size: 1.05rem; font-weight: 650; color: #fff; }
.terminal-bar .store-code { font-size: .8rem; color: #8b95a3; }
.terminal-bar a { color: #8b95a3; font-size: .88rem; }

.terminal-grid {
	max-width: 1000px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1.15fr .85fr;
	gap: 1.25rem;
	align-items: start;
}
@media (max-width: 860px) { .terminal-grid { grid-template-columns: 1fr; } }

.panel {
	background: #182029;
	border: 1px solid rgba(255,255,255,.09);
	border-radius: var(--radius-lg);
	padding: 1.5rem;
}
.panel h2 { color: #fff; font-size: 1.02rem; }
.panel .hint { color: #8b95a3; font-size: .87rem; }

.code-display {
	text-align: center;
	padding: 1.75rem 1rem;
	background: #0c1117;
	border: 1px dashed rgba(255,255,255,.16);
	border-radius: var(--radius-lg);
	margin-bottom: 1.1rem;
}
.code-display .code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 3.4rem;
	font-weight: 700;
	letter-spacing: .18em;
	color: #fff;
	line-height: 1.1;
	text-indent: .18em;
}
.code-display .countdown { margin-top: .5rem; font-size: .92rem; color: #8b95a3; }
.code-display .countdown strong { color: #f0b429; }
.code-display.used   { border-color: var(--ok); }
.code-display.used .code { color: #4fd1a5; }
.code-display.dead   { opacity: .45; }
.code-type {
	margin-top: .7rem;
	font-size: .74rem;
	font-weight: 700;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: #93b3ff;
}
.code-amount { margin-top: .35rem; font-size: .95rem; color: #c3ccd8; }
.code-amount strong { color: #fff; }
.code-fee    { margin-top: .25rem; font-size: .78rem; color: #f0b429; }
.code-photos { margin-top: .3rem; font-size: .82rem; color: #6ee0b4; }

/* Each document the store still owes on an open return, with its own QR */
.doc-asks { display: flex; flex-direction: column; gap: .55rem; margin-top: .6rem; }

.doc-ask {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .55rem .65rem;
	border: 1px solid rgba(255,255,255,.12);
	border-radius: var(--radius);
	background: #0c1117;
	/* A dark box inside the white card: back to light text. */
	color: #e8edf4;
}
.doc-ask-qr { flex: none; width: 74px; background: #fff; border-radius: 6px; padding: 4px; }
.doc-ask-qr svg { display: block; width: 100%; height: auto; }
.doc-ask-body { min-width: 0; }
.doc-ask-name { font-size: .84rem; font-weight: 650; color: #e8edf4; margin-bottom: .45rem; }

/* One picker per outstanding document, both feeding the same Send */
/* Stacked, not side by side: every filename has to stay readable */
.doc-upload-form { display: block; }
.doc-pick { display: block; margin-bottom: .6rem; }
.doc-pick .doc-pick-btn { margin-right: .4rem; }
.doc-pick:last-of-type { margin-bottom: .75rem; }

@media (max-width: 520px) {
	.doc-ask { flex-direction: column; align-items: flex-start; }
	.doc-ask-qr { width: 110px; }
}

/* Refund vs laybuy, chosen on the terminal before a code exists */
.type-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (max-width: 520px) { .type-choice { grid-template-columns: 1fr; } }

.type-radio { position: absolute; opacity: 0; pointer-events: none; }

.type-option {
	display: flex;
	flex-direction: column;
	gap: .2rem;
	padding: .75rem .85rem;
	border: 1.5px solid rgba(255,255,255,.14);
	border-radius: var(--radius);
	background: #0c1117;
	cursor: pointer;
	margin: 0;
	transition: border-color .15s, background .15s;
}
.type-option:hover { border-color: rgba(255,255,255,.3); }
.type-radio:checked + .type-option { border-color: #93b3ff; background: #111a26; }
.type-radio:focus-visible + .type-option { outline: 2px solid #93b3ff; outline-offset: 2px; }

.type-name  { font-size: .92rem; font-weight: 650; color: #e8edf4; }
.type-blurb { font-size: .76rem; color: #8b95a3; line-height: 1.35; }

.fee-preview {
	margin-top: .5rem;
	padding: .55rem .7rem;
	border-radius: var(--radius);
	background: rgba(240,180,41,.13);
	border: 1px solid rgba(240,180,41,.3);
	font-size: .86rem;
	color: #f0c76a;
}
.fee-preview strong { color: #ffd97a; }
.fee-preview span   { display: block; margin-top: .15rem; font-size: .76rem; color: #cbb489; }

/* What the customer is getting back, stated plainly before they sign */
.amount-panel {
	margin-bottom: 1.25rem;
	padding: .9rem 1.1rem 1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--canvas);
}
.amount-panel.has-fee { border-color: #e8c37a; background: #fdf9f0; }

.amount-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	padding: .3rem 0;
	font-size: .92rem;
	color: var(--ink-soft);
}
.amount-row.fee { color: #8a5a00; }
.amount-row.total {
	margin-top: .35rem;
	padding-top: .6rem;
	border-top: 1px solid var(--line);
	font-size: 1rem;
	font-weight: 650;
	color: var(--ink);
}
.amount-row.total span:last-child { font-size: 1.35rem; font-weight: 700; }
.amount-panel.has-fee .amount-row.total { border-top-color: #e8c37a; }

.amount-note {
	margin: .7rem 0 0;
	font-size: .8rem;
	line-height: 1.5;
	color: var(--ink-faint);
}

/* Told to the customer on a laybuy, since it changes what they are signing */
.fee-notice {
	margin-bottom: 1.25rem;
	padding: .85rem 1rem;
	border: 1px solid #e8c37a;
	border-left: 4px solid #d99a1f;
	border-radius: var(--radius);
	background: #fdf6e6;
	color: #6b4a06;
	font-size: .9rem;
	line-height: 1.5;
}

.head-badges { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* Every note anyone has left on a return, gathered in one place */
.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8rem; }

.note-list li {
	padding: .8rem .95rem;
	border: 1px solid var(--line);
	border-left: 3px solid var(--brand);
	border-radius: var(--radius);
	background: var(--canvas);
}

.note-body {
	font-size: .93rem;
	line-height: 1.55;
	color: var(--ink);
	white-space: pre-line;
	word-break: break-word;
}

.note-meta { margin-top: .45rem; font-size: .78rem; color: var(--ink-faint); }
.note-who  { font-weight: 650; color: var(--ink-soft); }

.note-action { font-weight: 650; }
.note-action.rejected, .note-action.sent_back { color: var(--bad); }
.note-action.approved, .note-action.completed { color: var(--ok); }
.note-action.deleted { color: var(--bad); }

.note-list li:has(.note-action.rejected),
.note-list li:has(.note-action.sent_back),
.note-list li:has(.note-action.deleted) { border-left-color: var(--bad); }
.note-list li:has(.note-action.completed) { border-left-color: var(--ok); }

/* Tick-list actions on the returns page, for super admins */
.bulk-bar {
	display: flex;
	align-items: center;
	gap: .6rem;
	flex-wrap: wrap;
	margin-bottom: 1rem;
	padding: .7rem .9rem;
	border: 1px solid var(--brand);
	border-radius: var(--radius);
	background: var(--brand-wash);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar input[type="text"] {
	flex: 1 1 20rem;
	min-width: 12rem;
	margin: 0;
}
.bulk-count { font-size: .86rem; font-weight: 650; color: var(--ink); white-space: nowrap; }

th.tick, td.tick { width: 1%; padding-right: 0; text-align: center; }
th.tick input, td.tick input { width: 1rem; height: 1rem; margin: 0; cursor: pointer; }

.chip-label {
	align-self: center;
	margin-right: .1rem;
	font-size: .74rem;
	font-weight: 700;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

/* Which kind of return this is - shown wherever refunds are listed */
.badge-type-refund { background: var(--line-soft); color: var(--ink-soft); }
.badge-type-laybuy { background: #fdf0d5; color: #8a5a00; }

/* The uploads on the terminal share the customer form's markup, on a dark panel */
.panel .upload-drop {
	border-color: rgba(255,255,255,.18);
	background: #0c1117;
}
.panel .upload-drop:hover,
.panel .upload-input:focus + .upload-drop,
.panel .upload-input:focus-visible + .upload-drop {
	border-color: #93b3ff;
	background: #111a26;
}
.panel .upload-main { color: #e8edf4; }
.panel .upload-sub  { color: #8b95a3; }

.code-state {
	margin-top: .9rem;
	padding: .7rem .9rem;
	border-radius: var(--radius);
	font-size: .9rem;
	font-weight: 600;
	text-align: center;
}
.code-state.live { background: rgba(31,79,216,.16); color: #93b3ff; }
.code-state.used { background: rgba(18,128,92,.18); color: #6ee0b4; }
.code-state.dead { background: rgba(192,54,44,.16); color: #f0a49d; }

.qr-box { background: #fff; border-radius: var(--radius-lg); padding: 1.1rem; text-align: center; }
.qr-box svg { width: 100%; height: auto; max-width: 230px; display: block; margin: 0 auto; }
.qr-box .url { margin-top: .7rem; font-size: .74rem; color: var(--ink-faint); word-break: break-all; }

/* Signature pad */
.sig-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.sig-wrap.filled { border-color: var(--ok); }
.sig-pad { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; background: #fff; }
.sig-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: .5rem .75rem;
	border-top: 1px solid var(--line-soft);
	background: #fbfcfd;
	font-size: .82rem;
	color: var(--ink-faint);
}

.section-title {
	display: flex;
	align-items: center;
	gap: .6rem;
	margin: 1.75rem 0 .9rem;
	font-size: .78rem;
	text-transform: uppercase;
	letter-spacing: .07em;
	font-weight: 700;
	color: var(--ink-faint);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-title:first-child { margin-top: 0; }

.expiry-strip {
	background: var(--warn-wash);
	color: var(--warn);
	padding: .55rem .9rem;
	border-radius: var(--radius);
	font-size: .85rem;
	font-weight: 600;
	text-align: center;
	margin-bottom: 1.25rem;
}

.done-mark {
	width: 68px; height: 68px;
	margin: 0 auto 1.1rem;
	border-radius: 50%;
	background: var(--ok-wash);
	color: var(--ok);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2rem;
}
.reference-box {
	background: var(--canvas);
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	padding: 1rem;
	text-align: center;
	margin: 1.25rem 0;
}
.reference-box .ref {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 1.4rem;
	font-weight: 700;
	letter-spacing: .04em;
}

/* -------------------------------------------------------------- print */

@media print {
	.no-print { display: none !important; }
	body { background: #fff; }
	.card { box-shadow: none; border-color: #ccc; }
	.shell { display: block; }
	.sidebar, .topbar { display: none; }
	.content { padding: 0; max-width: none; }
}

/* ------------------------------------------------- document uploads
   The visible control is the label; the real <input type="file"> is kept
   off-screen rather than display:none so it stays keyboard reachable and
   screen readers still announce it. */

.upload-input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.upload-drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .2rem;
	padding: 1.35rem 1rem;
	border: 1.5px dashed var(--line);
	border-radius: var(--radius);
	background: var(--canvas);
	cursor: pointer;
	text-align: center;
	margin: 0;
	transition: border-color .15s, background .15s;
}

.upload-drop:hover,
.upload-input:focus + .upload-drop,
.upload-input:focus-visible + .upload-drop {
	border-color: var(--brand);
	background: var(--brand-wash);
}

.upload-icon { font-size: 1.5rem; line-height: 1; }
.upload-main { font-size: .95rem; font-weight: 600; color: var(--ink); }
.upload-sub  { font-size: .78rem; color: var(--ink-faint); font-weight: 500; }

/* What has actually been attached, one per line, each removable */
.upload-names {
	list-style: none;
	margin: .45rem 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: .3rem;
}

.upload-names:empty { margin: 0; }

.upload-names li {
	display: flex;
	align-items: center;
	gap: .5rem;
	padding: .4rem .55rem;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--paper);
	font-size: .82rem;
	color: var(--ink-soft);
}

.upload-names li::before { content: "\1F4C4"; flex: none; }
.upload-name { flex: 1 1 auto; word-break: break-all; }

.upload-remove {
	flex: none;
	width: 1.4rem;
	height: 1.4rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--line-soft);
	color: var(--ink-faint);
	font-size: 1rem;
	line-height: 1;
	cursor: pointer;
}
.upload-remove:hover { background: var(--bad-wash); color: var(--bad); }

/* The same list on the terminal's dark panel */
.panel .upload-names li {
	border-color: rgba(255,255,255,.12);
	background: #0c1117;
	color: #c3ccd8;
}
.panel .upload-remove { background: rgba(255,255,255,.1); color: #8b95a3; }
.panel .upload-remove:hover { background: rgba(192,54,44,.3); color: #f0a49d; }
/* Documents on the admin refund page and the store terminal */

.doc-list { list-style: none; margin: 0; padding: 0; }

.doc-list li {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: .6rem;
	padding: .5rem 0;
	border-bottom: 1px solid var(--line-soft);
	font-size: .88rem;
}

.doc-list li:last-child { border-bottom: 0; }
.doc-list .doc-meta { color: var(--ink-faint); font-size: .78rem; white-space: nowrap; }

.doc-missing {
	padding: .6rem .75rem;
	border-radius: 8px;
	background: var(--warn-wash);
	color: var(--warn);
	font-size: .85rem;
}

/* Outstanding refund slips on the store terminal */

.pending-list { display: flex; flex-direction: column; gap: .9rem; }

.pending-item {
	display: flex;
	gap: .9rem;
	align-items: flex-start;
	padding: .85rem;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--paper);
	/* The terminal page sets light text for its dark background. This card is
	   white, so anything inheriting - the reference number, the sent-back
	   reason - was near-white on white. */
	color: var(--ink);
}

.pending-qr { flex: none; width: 116px; line-height: 0; }
.pending-qr svg { width: 116px; height: 116px; display: block; }
.pending-body { flex: 1; min-width: 0; }
.pending-ref  { font-weight: 700; font-family: var(--mono, monospace); }
.pending-meta { font-size: .8rem; color: var(--ink-faint); margin-top: .1rem; }
.pending-actions { margin-top: .6rem; }

@media (max-width: 560px) {
	.pending-item { flex-direction: column; align-items: stretch; }
	.pending-qr   { width: 100%; text-align: center; }
	.pending-qr svg { margin: 0 auto; }
}

/* Refund summary on the scanned slip-upload page */

.slip-summary {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	margin-bottom: 1.25rem;
	font-size: .9rem;
}

.slip-summary th,
.slip-summary td {
	padding: .55rem .75rem;
	text-align: left;
	border-bottom: 1px solid var(--line-soft);
}

.slip-summary tr:last-child th,
.slip-summary tr:last-child td { border-bottom: 0; }

.slip-summary th {
	width: 38%;
	font-weight: 600;
	color: var(--ink-faint);
	font-size: .8rem;
}

/* ------------------------------------------- customer QR poster (store side)
   A standalone printable sheet the store can produce from the terminal, so
   putting a QR at the till never needs an admin sign-in. */

.poster-page { background: var(--canvas); }

.poster-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	padding: .85rem 1.1rem;
	background: var(--paper);
	border-bottom: 1px solid var(--line);
}

.poster-sheet {
	max-width: 640px;
	margin: 1.75rem auto;
	padding: 2.5rem 2rem 2rem;
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
	text-align: center;
}

.poster-eyebrow {
	font-size: .78rem;
	letter-spacing: .14em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--brand);
}

.poster-title { margin: .5rem 0 .25rem; font-size: 2rem; line-height: 1.15; }
.poster-sub   { margin: 0; color: var(--ink-soft); font-size: 1.02rem; }

.poster-qr { max-width: 320px; margin: 1.75rem auto 1.25rem; }
.poster-qr svg { width: 100%; height: auto; display: block; }

.poster-store { font-size: 1.15rem; font-weight: 700; }
.poster-code  { font-size: .85rem; color: var(--ink-faint); }

.poster-steps {
	max-width: 380px;
	margin: 1.75rem auto 0;
	padding-left: 1.2rem;
	text-align: left;
	color: var(--ink-soft);
	font-size: .92rem;
	line-height: 1.6;
}

.poster-url {
	margin-top: 1.5rem;
	font-size: .72rem;
	color: var(--ink-faint);
	word-break: break-all;
}

@media print {
	.poster-page { background: #fff; }
	.poster-sheet {
		margin: 0;
		max-width: none;
		border: 0;
		border-radius: 0;
		box-shadow: none;
		padding: 0;
	}
	.poster-qr { max-width: 340px; }
	.poster-title { font-size: 2.2rem; }
}

/* --------------------------------------------------- area mapping screen */

.chip span {
	display: inline-block;
	margin-left: .4rem;
	padding: 0 .34rem;
	border-radius: 999px;
	background: var(--line-soft);
	color: var(--ink-faint);
	font-size: .74rem;
	font-weight: 700;
}

.chip.on span    { background: rgba(255, 255, 255, .25); color: #fff; }
.chip-warn       { border-color: var(--warn); color: var(--warn); }
.chip-warn span  { background: var(--warn-wash); color: var(--warn); }

.bulk {
	display: flex;
	align-items: center;
	gap: .6rem;
	flex-wrap: wrap;
}

.bulk .check       { margin: 0; }
.bulk .check span  { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.bulk select       { width: auto; min-width: 190px; padding: .38rem .6rem; font-size: .86rem; }

/* A row whose manager differs from what is stored, so it is obvious what
   "Save changes" is about to write. */
.row-manager.changed {
	border-color: var(--brand);
	background: var(--brand-wash);
	font-weight: 600;
}

table.data td select { width: 100%; padding: .34rem .5rem; font-size: .86rem; }
table.data td input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brand); }

/* Open returns: rows that still need something from the store stand out */

.pending-head {
	display: flex;
	align-items: center;
	gap: .5rem;
	flex-wrap: wrap;
	margin-bottom: .15rem;
}

.pending-item.needs-slip {
	border-color: var(--warn);
	background: var(--warn-wash);
}

/* A return that was sent back to the store: the reason first, then the way to
   put it right and resend. */
.pending-item.sent-back {
	border-color: var(--bad);
}

.sent-back-why {
	margin-top: .5rem;
	padding: .55rem .7rem;
	border-left: 3px solid var(--bad);
	border-radius: 6px;
	background: rgba(192, 54, 44, .08);
}

.sent-back-head {
	font-size: .78rem;
	font-weight: 650;
	color: var(--bad);
}

.sent-back-reason {
	margin-top: .15rem;
	font-size: .9rem;
	line-height: 1.45;
}

.doc-resend-form .resend-note {
	width: 100%;
	margin: .5rem 0;
}

.bad-text { color: var(--bad); }

.pending-state {
	margin-top: .5rem;
	font-size: .8rem;
	color: var(--ink-faint);
}

.pending-state.bad { color: var(--bad); }

/* ------------------------------------------------- approval checklist */

/* The three points every approver confirms, and the grid showing which desk
   has confirmed which. */

.checklist {
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: .7rem .85rem .2rem;
	margin: 0 0 1rem;
	background: var(--canvas);
}

.checklist legend {
	font-size: .78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--ink-soft);
	padding: 0 .35rem;
}

.checklist .check { margin-bottom: .6rem; }
.checklist .check label { font-size: .88rem; line-height: 1.35; }

.block { display: block; }

table.check-matrix {
	width: 100%;
	border-collapse: collapse;
	font-size: .86rem;
}

table.check-matrix th,
table.check-matrix td {
	border-bottom: 1px solid var(--line-soft);
	padding: .55rem .6rem;
	vertical-align: top;
}

table.check-matrix thead th {
	font-size: .74rem;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--ink-faint);
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
}

table.check-matrix thead th.here { color: var(--brand); }

table.check-matrix tbody th {
	text-align: left;
	font-weight: 600;
	color: var(--ink);
}

table.check-matrix td {
	text-align: center;
	width: 7.5rem;
	font-size: 1rem;
}

table.check-matrix td.ticked { color: var(--ok); font-weight: 700; }
table.check-matrix tbody tr:last-child th,
table.check-matrix tbody tr:last-child td { border-bottom: none; }

/* ---------------------------------------------- refund terms and conditions */

/* The client's wording, shown to the customer above the signature and echoed
   back on the refund page so staff can see what was agreed to. */

.terms {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--canvas);
	padding: .9rem 1rem .95rem;
	margin: 0 0 1.25rem;
}

.terms-list {
	margin: 0;
	padding-left: 1.2rem;
	font-size: .88rem;
	line-height: 1.5;
	color: var(--ink);
}

.terms-list li + li { margin-top: .45rem; }

.terms-consent {
	margin: .8rem 0 0;
	padding-top: .75rem;
	border-top: 1px solid var(--line);
	font-size: .82rem;
	line-height: 1.5;
	color: var(--ink-soft);
}

/* On the refund page the same text is folded away - it is reference, not
   something an approver needs in their way on every visit. */
.terms-signed summary {
	cursor: pointer;
	font-size: .84rem;
	font-weight: 600;
	color: var(--ink-soft);
}

.terms-signed summary::marker { color: var(--ink-faint); }
.terms-signed[open] summary { margin-bottom: .5rem; }
.terms-signed .terms-list { padding-left: 1.1rem; }
.terms-signed .terms-list li + li { margin-top: .3rem; }

/* ------------------------------------------------------- document download */

/* The little arrow beside a document: present enough to find, quiet enough not
   to compete with the filename it belongs to. */
.doc-download {
	display: inline-block;
	margin-left: .3rem;
	padding: 0 .28rem;
	border-radius: 4px;
	font-size: .82rem;
	line-height: 1.4;
	color: var(--ink-faint);
	text-decoration: none;
}

.doc-download:hover,
.doc-download:focus {
	background: var(--brand-wash);
	color: var(--brand);
}

/* ------------------------------------------------- duplicate-claim warnings
   The point of all of this is to be impossible to skim past. A flagged return
   carries a red card above its own reference, a red row in the listing and a
   red count in the sidebar; everything else on the page keeps the quiet palette
   so that the one loud thing stays loud. */

.sidebar nav .count-bad { background: var(--bad); color: #fff; }
.sidebar nav a.on .count-bad { background: rgba(0,0,0,.28); }

.dup-card { border-width: 2px; }
.dup-card .card-head h3 { display: flex; align-items: center; gap: .4rem; }

.dup-group + .dup-group { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--line); }
.dup-title { font-weight: 650; color: var(--ink); }

.dup-list { list-style: none; margin: .45rem 0 0; padding: 0; }
.dup-list li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4rem;
	padding: .4rem .6rem;
	background: var(--canvas);
	border-radius: var(--radius);
	font-size: .88rem;
}
.dup-list li + li { margin-top: .35rem; }

.dup-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: .6rem;
	margin-top: 1rem;
	padding-top: .8rem;
	border-top: 1px solid var(--line);
}

/* The marker in the returns listing. */
.dup-mark { color: var(--bad); font-weight: 700; margin-right: .15rem; cursor: help; }
tr.row-flagged > td, tr.row-flagged > th { background: var(--bad-wash); }
tr.row-flagged:hover > td { background: #fbe0dd; }

.chip-flag { border-color: #f3c3be; color: var(--bad); }
.chip-flag.on { background: var(--bad); border-color: var(--bad); color: #fff; }

/* The extra checklist item a flagged return adds to the approve form. */
.field.check.check-flagged {
	background: var(--bad-wash);
	border: 1px solid #f3c3be;
	border-radius: var(--radius);
	padding: .5rem .6rem;
}

/* A section heading that sits outside a card, on the alerts board. */
.card-head-bare {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: .5rem;
	margin: 0 0 .7rem;
}
.card-head-bare h2 { margin: 0; font-size: 1.02rem; }

/* ---------------------------------------------------------------------------
   Settings: notification channel on/off switches
   ------------------------------------------------------------------------- */
.channel {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: .85rem 0;
	border-top: 1px solid var(--line-soft);
}
.channel-text { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.channel-text strong { font-size: .98rem; }

.switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: .55rem;
	margin: 0;
	flex: none;
	cursor: pointer;
}
.switch input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}
.switch-track {
	position: relative;
	width: 44px;
	height: 24px;
	border-radius: 999px;
	background: #c9d1dc;
	transition: background .15s ease;
}
.switch-track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgba(20, 24, 31, .25);
	transition: transform .15s ease;
}
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-state { min-width: 2rem; font-size: .85rem; font-weight: 600; color: var(--ink-faint); }
.switch-state::before { content: "Off"; }
.switch input:checked ~ .switch-state { color: var(--ok); }
.switch input:checked ~ .switch-state::before { content: "On"; }

/* Customer form: the twice-typed account number. */
.field-hint.match-ok  { color: var(--ok); font-weight: 600; }
.field-hint.match-bad { color: var(--bad); font-weight: 600; }
