:root {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: #172a28;
  background: #f5f5ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #172a28;
  --muted: #778581;
  --line: #e8eae2;
  --green: #176d54;
  --mint: #e2f3e9;
  --surface: #fff;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 700; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 13px; color: #fff; background: #176d54; font-size: 20px; }
.brand-light { color: #fff; }
.brand-light .brand-mark { color: #176d54; background: #e8f6e9; }
.brand-dark { color: var(--ink); }
.eyebrow { margin: 0 0 7px; color: #71817a; font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.muted { color: var(--muted); line-height: 1.8; }
.button { min-height: 43px; padding: 9px 18px; border: 0; border-radius: 11px; font-weight: 600; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: #176d54; }
.button-primary:hover { background: #105c46; }
.button-dark { color: white; background: #1d302d; }
.button-dark:hover { background: #314440; }
.button-wide { width: 100%; }
.text-button { padding: 7px 0; border: 0; color: #176d54; background: transparent; font-weight: 600; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; color: #677773; background: #fff; font-size: 20px; }
label { display: grid; gap: 7px; margin: 15px 0; color: #344642; font-size: 13px; font-weight: 600; }
input, textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #e1e6df; border-radius: 10px; outline: 0; color: var(--ink); background: #fff; }
input:focus, textarea:focus { border-color: #6ca58f; box-shadow: 0 0 0 3px #176d5414; }
input[type="color"] { height: 42px; padding: 4px; }
textarea { resize: vertical; }
.form-message { min-height: 20px; margin: 8px 0; color: #a34035; font-size: 13px; }

.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(320px, 42%) 1fr; }
.auth-aside { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: 40px 10%; overflow: hidden; color: #fff; background: #153d34; }
.auth-aside::before, .auth-aside::after { position: absolute; content: ""; border: 1px solid #ffffff18; border-radius: 50%; }
.auth-aside::before { width: 430px; height: 430px; left: -180px; bottom: 40px; }
.auth-aside::after { width: 320px; height: 320px; left: -125px; bottom: 95px; }
.auth-pitch { z-index: 1; max-width: 430px; margin: auto 0; }
.auth-pitch .eyebrow { color: #a4c8b7; }
.auth-pitch h1 { margin: 12px 0 18px; font-size: clamp(38px, 4.4vw, 61px); line-height: 1.4; }
.auth-pitch p:last-child { max-width: 370px; color: #c4d8cf; line-height: 2; }
.aside-note { color: #aac6b9; font-size: 13px; }
.auth-main { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(100%, 400px); }
.auth-card .brand { margin-bottom: 50px; }
.auth-card h2, .setup-panel h2, .dialog h2 { margin: 0; font-size: 27px; }
.auth-card .muted { margin: 6px 0 26px; font-size: 14px; }
.auth-card .button { margin-top: 12px; }
.auth-card .text-button { display: block; margin: 12px auto 0; }
.form-message:empty { min-height: 0; }
.success-message { color: #176d54; }

.app-layout { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 0 0 auto; display: flex; width: 250px; flex-direction: column; padding: 26px 19px 18px; border-left: 1px solid var(--line); background: #fff; }
.sidebar .brand { margin: 0 0 49px 8px; }
.sidebar-label { margin: 0 9px 12px; color: #9aa6a1; font-size: 11px; }
.nav-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; color: #66736e; background: transparent; text-align: right; font-size: 13px; }
.nav-link span { width: 19px; color: #70817a; font-size: 19px; text-align: center; }
.nav-link:hover, .nav-link.active { color: #175b47; background: #eaf5ed; font-weight: 600; }
.sidebar-bottom { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 2px 0; border-top: 1px solid var(--line); }
.profile-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #176d54; background: #e2f3e9; font-weight: 700; }
.profile-copy { display: grid; min-width: 0; flex: 1; }
.profile-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; direction: ltr; text-align: right; }
.profile-copy small { color: var(--muted); font-size: 10px; }
.workspace { max-width: 1450px; margin-right: 250px; padding: 30px clamp(22px, 4vw, 62px) 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 31px; }
.topbar h1 { margin: 0; font-size: 26px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.live-indicator { display: flex; align-items: center; gap: 8px; color: #75827e; font-size: 11px; }
.live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: #41a778; box-shadow: 0 0 0 3px #41a77820; }
.welcome-card { position: relative; display: flex; min-height: 191px; align-items: center; justify-content: space-between; padding: 28px 34px; overflow: hidden; border-radius: 17px; color: #fff; background: #176d54; }
.welcome-card .eyebrow { color: #c3e2cf; }
.welcome-card h2 { margin: 4px 0 5px; font-size: 24px; }
.welcome-card p:last-child { margin: 0; color: #d0e5da; font-size: 13px; }
.welcome-art { position: relative; display: grid; width: 135px; height: 135px; place-items: center; border: 1px solid #ffffff32; border-radius: 40px; background: #ffffff12; transform: rotate(-9deg); }
.welcome-art span { color: #f3d482; font-size: 65px; }
.welcome-art b { position: absolute; right: -7px; bottom: 5px; padding: 6px 13px; border-radius: 18px; color: #29483c; background: #f6e8b7; font-size: 13px; transform: rotate(9deg); }
.welcome-art i { position: absolute; top: 1px; left: 4px; color: #b7dac1; font-size: 25px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin: 20px 0 36px; }
.stat-card { min-height: 156px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.stat-icon { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 11px; font-size: 18px; }
.mint { color: #327958; background: #e5f4e9; }
.lilac { color: #6853a1; background: #eee8fb; }
.peach { color: #ae7132; background: #fff0dd; }
.stat-card p { margin: 12px 0 2px; color: #75827e; font-size: 12px; }
.stat-card strong { margin-left: 5px; font-size: 24px; }
.stat-card small { color: #9aa49f; font-size: 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.section-heading .eyebrow { margin-bottom: 2px; }
.customer-list { display: grid; gap: 9px; }
.customer-row { display: flex; align-items: center; gap: 13px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.customer-avatar { display: grid; width: 42px; height: 42px; flex: none; place-items: center; border-radius: 13px; color: #287355; background: #e8f4e9; font-weight: 700; }
.customer-info { min-width: 115px; flex: 1; }
.customer-info strong { display: block; font-size: 13px; }
.customer-info small { color: #87938e; font-size: 11px; }
.customer-points { min-width: 66px; text-align: center; }
.customer-points strong { display: block; color: #176d54; font-size: 16px; }
.customer-points small { color: #8b9791; font-size: 10px; }
.customer-actions { display: flex; align-items: center; gap: 7px; }
.small-button, .pass-link { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; padding: 6px 10px; border: 1px solid #e2e9e1; border-radius: 9px; color: #176d54; background: #fff; font-size: 11px; text-decoration: none; white-space: nowrap; }
.small-button:hover, .pass-link:hover { background: #eff7ef; }
.small-button.danger { color: #a34035; }
.page-section-heading { margin: 4px 0 22px; }
.customer-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; color: #74817b; font-size: 12px; }
.customer-toolbar input { width: min(100%, 260px); min-height: 38px; }
.empty-state { padding: 48px 20px; border: 1px dashed #d9e3d8; border-radius: 15px; background: #fbfcf8; text-align: center; }
.empty-state > span { color: #8fba9e; font-size: 38px; }
.empty-state h3 { margin: 8px 0 3px; }
.empty-state p { margin: 0 0 17px; color: var(--muted); font-size: 13px; }
.panel { padding: 25px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.setup-panel { max-width: 640px; margin: 65px auto; text-align: center; }
.setup-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 18px; place-items: center; border-radius: 16px; color: #176d54; background: #e3f3e7; font-size: 27px; }
.setup-panel .muted { margin: 8px auto 24px; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-panel h3 { margin: 0 0 17px; font-size: 17px; }
.upload-label span, .optional { color: #96a19b; font-size: 10px; font-weight: 400; }
.upload-label input { padding: 8px; font-size: 11px; }
.logo-preview { width: 100px; height: 70px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.settings-hint { padding: 12px; border-radius: 10px; color: #577b67; background: #eff7ef; font-size: 12px; line-height: 1.8; }
.color-heading { margin: 22px 0 6px; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.color-grid label { margin: 8px 0; font-size: 11px; }
.settings-actions { display: flex; grid-column: 1 / -1; align-items: center; justify-content: flex-end; gap: 12px; }
.settings-actions .form-message { margin-left: auto; }
.dialog { width: min(94vw, 440px); padding: 0; border: 0; border-radius: 17px; color: var(--ink); box-shadow: 0 20px 80px #14231e38; }
.dialog::backdrop { background: #1c302c7a; backdrop-filter: blur(2px); }
.dialog > form, .dialog > div { position: relative; padding: 29px; }
.dialog label { margin: 18px 0; }
.dialog-close { position: absolute; top: 14px; left: 16px; width: 32px; height: 32px; border: 0; border-radius: 50%; color: #73807b; background: #f0f2ec; font-size: 22px; }
.scanner-dialog { width: min(94vw, 500px); }
.scanner-dialog h2 { margin-bottom: 16px; }
#scanner-video { width: 100%; max-height: 280px; margin: 10px 0; border-radius: 13px; background: #13221f; object-fit: cover; }
.scanner-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: #99a39e; font-size: 11px; }
.scanner-divider::before, .scanner-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.scan-form { display: flex; gap: 8px; }
.scanned-customer { padding: 12px; border-radius: 10px; color: #176d54; background: #eff7ef; font-size: 13px; }
.history-dialog { max-height: 80vh; overflow: auto; }
.history-list { display: grid; gap: 8px; margin-top: 18px; }
.history-item { display: flex; justify-content: space-between; gap: 12px; padding: 11px; border-radius: 10px; background: #f7f8f3; font-size: 12px; }
.history-item small { display: block; color: #8a9690; }
.history-positive { color: #176d54; font-weight: 700; }
.history-negative { color: #a34035; font-weight: 700; }
.toast { position: fixed; z-index: 10; right: 50%; bottom: 24px; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 11px; color: #fff; background: #1d302d; box-shadow: 0 8px 30px #172a2826; font-size: 13px; opacity: 0; pointer-events: none; transform: translate(50%, 12px); transition: .2s; }
.toast.visible { opacity: 1; transform: translate(50%, 0); }

@media (max-width: 950px) {
  .sidebar { width: 208px; }
  .workspace { margin-right: 208px; padding-inline: 24px; }
  .customer-actions { gap: 4px; }
  .small-button, .pass-link { padding-inline: 7px; }
}
@media (max-width: 720px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { min-height: 100vh; padding: 25px; }
  .auth-card .brand { margin-bottom: 34px; }
  .sidebar { z-index: 3; inset: auto 0 0; width: auto; height: 67px; flex-direction: row; justify-content: space-around; padding: 7px 10px; border-top: 1px solid var(--line); border-left: 0; }
  .sidebar .brand, .sidebar-label, .sidebar-bottom { display: none; }
  .nav-link { width: auto; flex-direction: column; gap: 0; padding: 3px 10px; font-size: 9px; }
  .nav-link span { font-size: 17px; }
  .workspace { margin: 0; padding: 21px 15px 90px; }
  .topbar { margin-bottom: 20px; }
  .topbar h1 { font-size: 22px; }
  .live-indicator { display: none; }
  .topbar-actions .button { min-height: 38px; padding: 7px 12px; font-size: 11px; }
  .welcome-card { min-height: 155px; padding: 20px; }
  .welcome-card h2 { font-size: 20px; }
  .welcome-art { width: 90px; height: 90px; border-radius: 28px; }
  .welcome-art span { font-size: 49px; }
  .stats-grid { gap: 8px; margin: 13px 0 25px; }
  .stat-card { min-height: 131px; padding: 12px 10px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-card p { font-size: 10px; }
  .stat-card strong { font-size: 20px; }
  .stat-card small { display: block; font-size: 9px; }
  .customer-row { flex-wrap: wrap; gap: 9px; padding: 10px; }
  .customer-info { min-width: calc(100% - 68px); }
  .customer-points { margin-right: auto; }
  .customer-actions { width: 100%; justify-content: flex-end; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-actions { grid-column: auto; }
  .settings-panel { padding: 18px; }
}
