/* qb_receipts — base.css
   Dark slate canvas with amber accent, paper-like cards, monospace numerics.
*/

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Fraunces:opsz,wght@9..144,500;9..144,700;9..144,900&family=Manrope:wght@400;500;600;700&display=swap');

:root {
	--bg-deep:        #0e1218;
	--bg:             #131923;
	--bg-raised:      #1b2332;
	--bg-card:        #f4ecdb;       /* receipt-paper cream */
	--bg-card-line:   #e6dcc4;
	--ink:            #d8e0ec;
	--ink-dim:        #8b94a3;
	--ink-mute:       #5b6473;
	--ink-paper:      #1a1410;
	--ink-paper-dim:  #6c5f4e;
	--accent:         #ffb547;       /* amber */
	--accent-2:       #ff7e3f;       /* burnt orange */
	--accent-cool:    #6cf3d3;       /* mint, used sparingly for success */
	--danger:         #ff5c6a;
	--border:         #232c3a;
	--border-strong:  #324053;
	--shadow-sm:      0 1px 2px rgba(0,0,0,.4);
	--shadow-md:      0 6px 16px rgba(0,0,0,.45);
	--radius-sm:      6px;
	--radius:         10px;
	--radius-lg:      16px;
	--mono:           'DM Mono', ui-monospace, Menlo, monospace;
	--display:        'Fraunces', Georgia, serif;
	--ui:             'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
	margin: 0;
	padding: 0;
	background: var(--bg-deep);
	color: var(--ink);
	font-family: var(--ui);
	font-size: 14px;
	line-height: 1.4;
	-webkit-font-smoothing: antialiased;
	min-height: 100vh;
	overflow-x: hidden;
}
body {
	background:
		radial-gradient(1100px 600px at 80% -10%, rgba(255,181,71,.08), transparent 60%),
		radial-gradient(900px 500px at -10% 100%, rgba(108,243,211,.05), transparent 60%),
		var(--bg-deep);
}

h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.1; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; font-weight: 700; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, .btn {
	font-family: var(--ui);
	font-weight: 600;
	font-size: 14px;
	background: var(--bg-raised);
	color: var(--ink);
	border: 1px solid var(--border-strong);
	padding: 8px 14px;
	height: 32px;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: background .12s, border-color .12s, transform .04s;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}
button:hover, .btn:hover { background: #232d3f; border-color: #3e4d63; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
	background: var(--accent);
	color: #1a1003;
	border-color: var(--accent);
}
.btn-primary:hover { background: #ffc163; border-color: #ffc163; }
.btn-danger { color: var(--danger); border-color: #5a2530; }
.btn-danger:hover { background: #2a1820; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; justify-content: center; height: 44px; font-size: 15px; }

input, select, textarea {
	font-family: var(--ui);
	font-size: 14px;
	background: var(--bg-raised);
	color: var(--ink);
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	padding: 6px 10px;
	height: 32px;
	width: 100%;
}
textarea { height: auto; min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(255,181,71,.15);
}
label { font-size: 12px; color: var(--ink-dim); font-weight: 600;
	letter-spacing: .04em; text-transform: uppercase; display: block; margin-bottom: 4px; }

/* App chrome */
.app {
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}
header.topbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	padding-top: calc(14px + env(safe-area-inset-top));
	border-bottom: 1px solid var(--border);
	background: rgba(14,18,24,.85);
	backdrop-filter: blur(12px);
	position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
	font-family: var(--display);
	font-weight: 900;
	font-size: 18px;
	letter-spacing: -.02em;
	color: var(--accent);
	display: flex; align-items: center; gap: 6px;
}
.topbar .brand:after {
	content: '';
	display: inline-block;
	width: 6px; height: 6px;
	background: var(--accent); border-radius: 50%;
	animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; transform: scale(.7); } }

.topbar .spacer { flex: 1; }

.company-pill {
	font-family: var(--mono);
	font-size: 12px;
	background: var(--bg-raised);
	color: var(--ink);
	border: 1px solid var(--border-strong);
	padding: 4px 10px 4px 8px;
	border-radius: 99px;
	height: 28px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
}
.company-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-cool); }

main.view {
	flex: 1;
	max-width: 920px;
	width: 100%;
	margin: 0 auto;
	padding: 18px 16px 80px;
}

.section { margin-bottom: 28px; }
.section h2 { margin-bottom: 12px; }

.card {
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px 16px;
}

/* Receipt-paper card variant for review */
.receipt-card {
	background: var(--bg-card);
	color: var(--ink-paper);
	border-radius: var(--radius);
	box-shadow: var(--shadow-md);
	overflow: hidden;
	display: grid;
	grid-template-columns: 90px 1fr;
	gap: 12px;
	padding: 12px;
	position: relative;
}
.receipt-card::before, .receipt-card::after {
	content: '';
	position: absolute;
	left: 0; right: 0;
	height: 8px;
	background: radial-gradient(circle at 4px 0, transparent 4px, var(--bg-card) 4px) repeat-x;
	background-size: 12px 8px;
}
.receipt-card::before { top: -7px; transform: scaleY(-1); }
.receipt-card::after  { bottom: -7px; }
.receipt-card .thumb { width: 90px; height: 110px; object-fit: cover; border-radius: 4px;
	box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.receipt-card .fields { display: grid; gap: 6px; }
.receipt-card label { color: var(--ink-paper-dim); }
.receipt-card input, .receipt-card select {
	background: rgba(255,255,255,.5);
	border: 1px solid var(--bg-card-line);
	color: var(--ink-paper);
}
.receipt-card .amount { font-family: var(--mono); font-size: 22px; font-weight: 600; }

.status-badge {
	display: inline-block;
	font-family: var(--mono);
	font-size: 10px;
	letter-spacing: .08em;
	padding: 2px 8px;
	border-radius: 99px;
	text-transform: uppercase;
}
.status-badge.uploaded   { background: rgba(108,243,211,.12); color: #6cf3d3; }
.status-badge.extracting { background: rgba(255,181,71,.12);  color: var(--accent); animation: pulse 1.4s infinite; }
.status-badge.review     { background: rgba(255,255,255,.08); color: var(--ink); }
.status-badge.posting    { background: rgba(255,126,63,.18);  color: var(--accent-2); animation: pulse 1.2s infinite; }
.status-badge.posted     { background: rgba(108,243,211,.18); color: var(--accent-cool); }
.status-badge.failed     { background: rgba(255,92,106,.18);  color: var(--danger); }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.empty {
	text-align: center;
	padding: 60px 20px;
	color: var(--ink-dim);
}
.empty .big {
	font-family: var(--display);
	font-size: 2rem;
	color: var(--ink);
	margin-bottom: 8px;
}

/* Capture FAB */
.fab {
	position: fixed;
	bottom: calc(24px + env(safe-area-inset-bottom));
	right: 24px;
	width: 64px; height: 64px;
	border-radius: 50%;
	background: var(--accent);
	color: #1a1003;
	border: none;
	font-size: 28px;
	box-shadow: 0 8px 24px rgba(255,181,71,.35), 0 2px 6px rgba(0,0,0,.5);
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	z-index: 40;
}
.fab:hover { background: #ffc163; }

/* Camera view */
.camera-stage {
	position: fixed; inset: 0;
	background: #000;
	z-index: 100;
	display: flex; flex-direction: column;
}
.camera-stage video {
	flex: 1; width: 100%; object-fit: cover;
}
.camera-stage .controls {
	background: rgba(0,0,0,.6);
	padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
	display: flex; align-items: center; justify-content: space-between;
}
.shutter {
	width: 72px; height: 72px; border-radius: 50%;
	background: #fff; border: 4px solid var(--accent);
	cursor: pointer;
}
.shutter:active { transform: scale(.92); }

.thumb-strip {
	position: fixed;
	bottom: 110px;
	left: 0; right: 0;
	display: flex; gap: 8px; overflow-x: auto;
	padding: 8px 16px;
	background: rgba(0,0,0,.4);
	z-index: 110;
}
.thumb-strip img {
	width: 56px; height: 70px; object-fit: cover; border-radius: 6px;
	border: 1px solid rgba(255,255,255,.25);
}

/* Modal / sheet */
.sheet-backdrop {
	position: fixed; inset: 0;
	background: rgba(0,0,0,.6);
	z-index: 200;
	display: flex; align-items: center; justify-content: center;
	padding: 24px;
}
.sheet {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	max-width: 480px; width: 100%;
	padding: 22px;
	box-shadow: var(--shadow-md);
}
.sheet h2 { margin-bottom: 16px; }

/* Toast */
.toast-stack {
	position: fixed;
	bottom: 100px;
	left: 50%; transform: translateX(-50%);
	display: flex; flex-direction: column; gap: 8px;
	z-index: 300;
}
.toast {
	font-family: var(--mono);
	font-size: 13px;
	background: var(--bg-raised);
	border: 1px solid var(--border-strong);
	color: var(--ink);
	padding: 10px 14px;
	border-radius: var(--radius);
	box-shadow: var(--shadow-md);
	max-width: 80vw;
}
.toast.error { border-color: rgba(255,92,106,.4); color: var(--danger); }
.toast.success { border-color: rgba(108,243,211,.4); color: var(--accent-cool); }

/* Login */
.login-shell {
	min-height: 100dvh;
	display: grid; place-items: center; padding: 20px;
}
.login-card {
	background: var(--bg-raised);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 40px 32px 32px;
	width: 100%; max-width: 360px;
	box-shadow: var(--shadow-md);
}
.login-card h1 {
	font-family: var(--display);
	color: var(--accent);
	margin-bottom: 4px;
}
.login-card .sub {
	font-family: var(--mono);
	font-size: 11px; letter-spacing: .12em;
	color: var(--ink-mute);
	text-transform: uppercase;
	margin-bottom: 28px;
}

/* Mobile niceties */
@media (max-width: 540px) {
	main.view { padding: 14px 12px 100px; }
	.receipt-card { grid-template-columns: 70px 1fr; }
	.receipt-card .thumb { width: 70px; height: 90px; }
}

/* Password show/hide */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-toggle {
	position: absolute;
	right: 4px; top: 50%; transform: translateY(-50%);
	background: transparent; border: none; cursor: pointer;
	color: var(--ink-dim); padding: 6px 10px; height: auto;
}

/* Progress bar */
.progress {
	height: 6px;
	background: var(--bg-raised);
	border-radius: 99px;
	overflow: hidden;
}
.progress > span {
	display: block; height: 100%;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
	transition: width .25s ease-out;
}

/* Numeric mono for amounts */
.mono { font-family: var(--mono); }
