:root {
  --ink: #17251d;
  --muted: #68766e;
  --line: #dfe6e1;
  --paper: #f4f6f2;
  --white: #fff;
  --green: #0f5a38;
  --green-2: #1c7c4f;
  --lime: #d9f09b;
  --gold: #f1c75b;
  --red: #9f2d32;
  --shadow: 0 18px 55px rgba(23, 37, 29, .09);
  --font-sans: "Helvetica Neue", Helvetica, Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

* { box-sizing: border-box; }
html { font-family: var(--font-sans); color: var(--ink); background: var(--paper); text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 3.5vw, 3.5rem); letter-spacing: -.045em; }
h2 { margin-bottom: .5rem; font-size: clamp(1.45rem, 2vw, 2.05rem); letter-spacing: -.03em; }
h3 { margin-bottom: .5rem; font-size: 1.2rem; }
.muted, small { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.login-body { background: #f4f5fb; }
.login-shell { min-height: 100dvh; display: grid; place-items: center; overflow: hidden; padding: clamp(18px, 4vw, 48px); background: radial-gradient(circle at 8% 12%, rgba(38,205,188,.13), transparent 25%), radial-gradient(circle at 91% 86%, rgba(93,82,233,.15), transparent 28%), #f4f5fb; }
.login-frame { width: min(100%, 960px); min-height: 570px; display: grid; grid-template-columns: .92fr 1.08fr; overflow: hidden; border: 1px solid rgba(31,34,57,.08); border-radius: 32px; background: var(--white); box-shadow: 0 34px 90px rgba(28,29,64,.14), 0 3px 12px rgba(28,29,64,.05); }
.login-copy { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 40px; color: var(--white); background: linear-gradient(145deg, #24246f 0%, #4f46d8 52%, #695cf0 100%); }
.login-copy::before { content: ""; position: absolute; z-index: -1; top: -110px; right: -105px; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; box-shadow: 0 0 0 55px rgba(255,255,255,.04), 0 0 0 110px rgba(255,255,255,.025); }
.login-copy::after { content: ""; position: absolute; z-index: -1; right: -36px; bottom: -50px; width: 185px; height: 185px; border-radius: 42px; background: linear-gradient(145deg, rgba(44,218,197,.45), rgba(44,218,197,.05)); transform: rotate(22deg); filter: blur(.2px); }
.login-brand { display: inline-flex; align-items: center; align-self: flex-start; gap: 10px; }
.login-brand img { display: block; width: 128px; height: auto; }
.login-brand > span { padding: 4px 7px; border: 1px solid rgba(255,255,255,.22); border-radius: 99px; color: rgba(255,255,255,.78); font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.login-story { margin: 48px 0 40px; }
.login-kicker { display: inline-flex; align-items: center; gap: 8px; color: rgba(255,255,255,.68); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.login-kicker i { width: 7px; height: 7px; border-radius: 50%; background: #2cdac5; box-shadow: 0 0 0 5px rgba(44,218,197,.12); }
.login-story h1 { margin: 20px 0 16px; font-size: clamp(44px, 5vw, 64px); line-height: .92; letter-spacing: -.065em; }
.login-story h1 em { color: #baf6ee; font-style: normal; }
.login-story p { max-width: 355px; margin: 0; color: rgba(255,255,255,.72); font-size: 14px; line-height: 1.65; }
.login-proof { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255,255,255,.15); padding-top: 20px; }
.login-proof > span { display: grid; gap: 4px; padding-right: 10px; }
.login-proof strong { font-size: 13px; }
.login-proof small { color: rgba(255,255,255,.56); font-size: 9px; }
.login-panel { display: grid; place-items: center; padding: clamp(34px, 5vw, 62px); background: rgba(255,255,255,.98); }
.login-card { width: min(100%, 390px); }
.login-card-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 58px; }
.login-card-top > a { color: #72758a; font-size: 11px; font-weight: 700; }
.login-card-top > a:hover { color: #4f46d8; }
.secure-badge { display: inline-flex; align-items: center; gap: 7px; color: #3e4258; font-size: 10px; font-weight: 800; }
.secure-badge i { width: 8px; height: 8px; border-radius: 50%; background: #20c7b5; box-shadow: 0 0 0 4px rgba(32,199,181,.12); }
.login-heading { margin-bottom: 28px; }
.login-heading .eyebrow { color: #5852e3; font-size: 9px; letter-spacing: .14em; }
.login-heading h2 { margin: 9px 0 8px; color: #17182a; font-size: clamp(28px, 3vw, 34px); letter-spacing: -.045em; }
.login-heading p { margin: 0; font-size: 13px; }
.login-form { gap: 16px; }
.login-form label { gap: 7px; color: #35384d; font-size: 11px; }
.login-form input { min-height: 48px; padding: 0 14px; border-color: #dfe1eb; border-radius: 12px; color: #17182a; background: #fafafd; font-size: 13px; }
.login-form input::placeholder { color: #a5a8b7; }
.login-form input:focus { border-color: #625bea; background: #fff; box-shadow: 0 0 0 4px rgba(98,91,234,.11); }
.login-submit { min-height: 49px; justify-content: space-between; margin-top: 4px; padding: 0 8px 0 18px; border: 0; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #5049da, #665df0); box-shadow: 0 12px 24px rgba(80,73,218,.22); }
.login-submit:hover { background: linear-gradient(135deg, #443dca, #5950e5); box-shadow: 0 15px 28px rgba(80,73,218,.28); }
.login-submit b { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.14); font-size: 16px; }
.login-card .form-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 22px; color: #8a8d9e; font-size: 9px; }
.login-card .form-note i { width: 5px; height: 5px; border-radius: 50%; background: #20c7b5; }
.login-card .form-note strong { color: #6b6e80; }

.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 800; letter-spacing: -.03em; }
.brand small { margin-left: .35rem; color: var(--green-2); font-size: .58rem; letter-spacing: .14em; }
.brand-light small { color: var(--lime); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--lime); color: var(--green); font-weight: 900; }
.eyebrow { display: inline-block; color: var(--lime); font-size: .74rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.eyebrow-dark { color: var(--green-2); }

.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .45rem; color: #445047; font-size: .86rem; font-weight: 700; }
input, select, textarea { width: 100%; padding: .82rem .9rem; border: 1px solid #cbd5ce; border-radius: 10px; color: var(--ink); background: var(--white); outline: none; transition: border .18s, box-shadow .18s; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(28,124,79,.1); }
.form-note { margin: 1.25rem 0 0; color: var(--muted); font-size: .78rem; text-align: center; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: .7rem 1rem; border: 1px solid transparent; border-radius: 10px; font-weight: 800; transition: transform .16s, background .16s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: var(--white); background: var(--green); }
.button-primary:hover { background: #0a472c; }
.button-light { color: var(--green); background: var(--lime); }
.button-ghost { width: 100%; border-color: rgba(255,255,255,.18); color: rgba(255,255,255,.82); background: transparent; }
.button-small { min-height: 32px; padding: .4rem .65rem; border-color: var(--line); background: var(--white); font-size: .78rem; }

.alert { margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 10px; font-size: .9rem; }
.alert-success { border: 1px solid #9bc8ac; color: #155a35; background: #e7f7ed; }
.alert-error { border: 1px solid #e2b2b5; color: var(--red); background: #fff0f0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; min-height: 100vh; height: 100vh; padding: 1.5rem; color: var(--white); background: #0d3727; }
.sidebar .brand { margin: .2rem 0 2rem; }
.user-chip { display: flex; align-items: center; gap: .75rem; padding: .85rem; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.05); }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { font-size: .83rem; }
.user-chip small { margin-top: .2rem; color: rgba(255,255,255,.55); font-size: .7rem; }
.avatar { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 50%; color: var(--green); background: var(--lime); font-weight: 900; }
.sidebar nav { display: grid; gap: .25rem; margin-top: 1.5rem; }
.sidebar nav a { padding: .72rem .8rem; border-radius: 9px; color: rgba(255,255,255,.64); font-size: .88rem; font-weight: 700; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--white); background: rgba(255,255,255,.11); }
.logout-form { margin-top: auto; }
.content { min-width: 0; padding: clamp(1.3rem, 3vw, 3rem); }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.environment-pill, .count-pill { display: inline-flex; padding: .45rem .65rem; border-radius: 999px; color: var(--green); background: var(--lime); font-size: .7rem; font-weight: 900; letter-spacing: .12em; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric { min-height: 175px; display: flex; flex-direction: column; padding: 1.25rem; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 8px 26px rgba(23,37,29,.04); }
.metric span { color: var(--muted); font-size: .83rem; font-weight: 700; }
.metric strong { margin: auto 0 .35rem; font-size: 3rem; letter-spacing: -.07em; }
.metric small { font-size: .75rem; }
.metric.accent { color: var(--white); border-color: var(--green); background: var(--green); }
.metric.accent span, .metric.accent small { color: rgba(255,255,255,.7); }
.panel { padding: clamp(1.15rem, 2.3vw, 2rem); border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 8px 26px rgba(23,37,29,.04); }
.panel + .panel, .card-grid + .panel { margin-top: 1rem; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.panel-head h2 { margin: 0; }
.mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.mini-grid span { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; border-radius: 12px; color: var(--muted); background: var(--paper); font-size: .8rem; }
.mini-grid strong { color: var(--ink); font-size: 1.7rem; }
.split-grid { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(0, 1.3fr); gap: 1rem; align-items: start; }
.scanner-grid, .qr-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.hero-panel, .customer-hero { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1rem; padding: clamp(2rem, 5vw, 4rem); border-radius: 24px; color: var(--white); background: radial-gradient(circle at 82% 20%, rgba(217,240,155,.2), transparent 35%), var(--green); }
.hero-panel { display: block; }
.hero-panel h2 { margin: .8rem 0; font-size: clamp(2.6rem, 5vw, 5rem); line-height: .95; }
.hero-panel p, .customer-hero p { color: rgba(255,255,255,.72); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: .7rem; color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: .85rem .7rem; border-top: 1px solid var(--line); font-size: .84rem; vertical-align: middle; }
td strong, td small { display: block; }
td small { margin-top: .2rem; font-size: .7rem; }
code { padding: .18rem .32rem; border-radius: 5px; background: #edf1ed; font: 600 .78rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.badge { display: inline-flex; padding: .28rem .48rem; border-radius: 999px; font-size: .67rem; font-weight: 900; text-transform: uppercase; }
.badge-ok { color: #145b34; background: #daf2e3; }
.badge-muted { color: #647069; background: #e8ece9; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.loyalty-card { position: relative; overflow: hidden; min-height: 230px; padding: 1.4rem; border-radius: 20px; color: var(--white); background: linear-gradient(145deg, #123f2c, #0f5a38); box-shadow: var(--shadow); }
.loyalty-card::after { content: ""; position: absolute; right: -45px; bottom: -60px; width: 160px; height: 160px; border: 30px solid rgba(217,240,155,.12); border-radius: 50%; }
.loyalty-card > * { position: relative; z-index: 1; }
.loyalty-card > span { color: var(--lime); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.loyalty-card h3 { margin-top: 1rem; font-size: 1.45rem; }
.loyalty-card p, .loyalty-card small { color: rgba(255,255,255,.72); }
.loyalty-card .button { margin-top: 1rem; color: var(--ink); }
.stamp-row { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.1rem 0; }
.stamp-row i { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: transparent; font-style: normal; }
.stamp-row i.filled { color: var(--green); border-color: var(--lime); background: var(--lime); }
.qr-card { display: grid; justify-items: center; padding: 2rem; border: 1px solid var(--line); border-radius: 22px; background: var(--white); text-align: center; box-shadow: var(--shadow); }
.qr-card canvas { width: min(100%, 280px); height: auto; margin: 1.3rem 0; padding: 12px; border: 1px solid var(--line); border-radius: 18px; }
.steps { display: grid; gap: 1rem; padding-left: 1.25rem; color: var(--muted); line-height: 1.55; }
.scanner-video { width: 100%; aspect-ratio: 4/3; margin-bottom: 1rem; border-radius: 14px; object-fit: cover; background: #0e1d15; }
.business-logo { width: 96px; height: 96px; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 18px; object-fit: contain; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .login-shell { padding: 16px; }
  .login-frame { min-height: 0; grid-template-columns: 1fr; border-radius: 24px; }
  .login-copy { min-height: 176px; padding: 25px; }
  .login-copy::before { top: -155px; right: -80px; }
  .login-copy::after { right: -55px; bottom: -85px; }
  .login-brand img { width: 114px; }
  .login-story { margin: 34px 0 0; }
  .login-kicker, .login-story p, .login-proof { display: none; }
  .login-story h1 { margin: 0; font-size: 34px; line-height: .95; }
  .login-panel { padding: 30px 25px 28px; }
  .login-card { width: 100%; }
  .login-card-top { margin-bottom: 34px; }
  .app-shell { display: block; }
  .sidebar { position: relative; height: auto; min-height: 0; }
  .sidebar nav { display: flex; overflow-x: auto; padding-bottom: .35rem; }
  .sidebar nav a { white-space: nowrap; }
  .logout-form { margin-top: 1rem; }
  .split-grid, .scanner-grid, .qr-layout { grid-template-columns: 1fr; }
  .wide { min-width: 0; }
}
@media (max-width: 560px) {
  .login-shell { padding: 0; place-items: stretch; }
  .login-frame { min-height: 100dvh; border: 0; border-radius: 0; }
  .login-copy { min-height: 150px; padding: 22px; }
  .login-story { margin-top: 28px; }
  .login-story h1 { font-size: 30px; }
  .login-panel { align-items: start; padding: 28px 22px; }
  .login-card-top { margin-bottom: 30px; }
  .login-heading { margin-bottom: 24px; }
  .content { padding: 1rem; }
  .metric-grid, .card-grid, .card-grid.compact, .mini-grid { grid-template-columns: 1fr; }
  .customer-hero { align-items: start; flex-direction: column; }
  .topbar { align-items: start; }
}
