@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #E8622C;
    --primary-dark: #C94F1E;
    --accent: #FFB627;
    --accent2: #2EC4B6;
    --bg: #FFF6ED;
    --card-bg: #FFFFFF;
    --text: #2B2118;
    --text-muted: #8A7A6D;
    --success: #21A366;
    --danger: #E8484A;
    --line: rgba(43, 33, 24, 0.08);
    --radius: 20px;
    --radius-sm: 14px;
    --shadow: 0 10px 28px rgba(232, 98, 44, 0.16);
    --shadow-sm: 0 6px 18px rgba(43, 33, 24, 0.07);
    --grad-primary: linear-gradient(120deg, var(--primary) 0%, var(--accent) 100%);
    --grad-accent: linear-gradient(120deg, var(--accent) 0%, #FF8C42 100%);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

.wrap {
    max-width: 460px;
    margin: 0 auto;
    padding: 24px 18px 60px;
    min-height: 100vh;
}

.wrap.wide { max-width: 900px; }

.top-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.top-brand .logo {
    width: 44px; height: 44px;
    border-radius: 14px;
    background: var(--grad-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.top-brand .logo svg { display: block; }
.logo-mark-bg { fill: var(--primary); }
.logo-mark-fg { fill: var(--accent); }
.logo-mark-ring { stroke: var(--accent); opacity: .55; }

.top-brand-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.logout-link { font-size: 12px; color: var(--text-muted); background: none; width: auto; margin: 0; padding: 6px 4px; text-decoration: underline; box-shadow: none; }

.top-brand .name { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 18px; }
.top-brand .sub { font-size: 12px; color: var(--text-muted); }

.card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 18px;
}

h1 { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 23px; font-weight: 700; margin: 0 0 6px; }
h2 { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 17px; font-weight: 700; margin: 0 0 10px; }
p.muted { color: var(--text-muted); font-size: 14px; margin: 0 0 16px; }

label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }

input[type="text"], input[type="tel"], input[type="number"] {
    width: 100%;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--line);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232, 98, 44, .14); }

button, .btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    background: var(--grad-primary);
    color: #fff;
    margin-top: 16px;
    box-shadow: var(--shadow);
    transition: transform .08s ease, opacity .15s ease, box-shadow .15s ease;
}
button:active { transform: scale(0.98); }
button.secondary { background: #FFF0E2; color: var(--primary-dark); box-shadow: none; }
button.ghost { background: transparent; color: var(--text-muted); box-shadow: none; }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.stamp-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 18px 0 6px;
}
.stamp {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px dashed #EAD9C4;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: #E0CCB2;
}
.stamp.filled {
    border-style: solid;
    border-color: var(--accent);
    background: var(--grad-accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.progress-text { text-align: center; font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.code-box {
    background: #FFF1E2;
    border-radius: var(--radius-sm);
    padding: 18px;
    text-align: center;
    margin: 18px 0;
}
.code-box canvas, .code-box svg { max-width: 100%; }
.code-box .qr-wrap { background: #fff; display: inline-block; padding: 10px; border-radius: 12px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.code-box .barcode-wrap { background: #fff; padding: 6px 0; border-radius: 10px; }

.reward-banner {
    background: var(--grad-accent);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    font-weight: 700;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.status-pill.ok { background: #E1F5EC; color: var(--success); }
.status-pill.risk { background: #FCE5E5; color: var(--danger); }
.status-pill.demo { background: #FFF1D1; color: #9A6B00; }

.scan-flash {
    position: fixed; inset: 0;
    background: rgba(33, 163, 102, .93);
    color: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 800; text-align: center; gap: 10px;
    z-index: 999;
    animation: fadeOut 1.4s forwards;
    padding: 20px;
}
.scan-flash.err { background: rgba(232, 72, 74, .94); }
.scan-flash.persist { animation: none; }
@keyframes fadeOut { 0% {opacity:1;} 70% {opacity:1;} 100% {opacity:0; visibility:hidden;} }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; box-shadow: var(--shadow-sm); text-align: center; }
.stat-box .num { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-box .lbl { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

#reader { border-radius: var(--radius-sm); overflow: hidden; }

.hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs button { margin: 0; flex: 1; background: #FFF0E2; color: var(--primary-dark); box-shadow: none; }
.tabs button.active { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-sm); }
