@font-face {
  font-family: Onest;
  src: url('/assets/onest-cyrillic.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0400-052F, U+2116;
}

@font-face {
  font-family: Onest;
  src: url('/assets/onest-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF, U+2212, U+2215;
}

@font-face {
  font-family: Cormorant;
  src: url('/assets/cormorant-cyrillic.woff2') format('woff2');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0400-052F, U+2116;
}

@font-face {
  font-family: Cormorant;
  src: url('/assets/cormorant-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-024F, U+1E00-1EFF, U+2000-206F, U+20A0-20CF, U+2212, U+2215;
}

:root {
  color-scheme: light;
  --paper: #f8f5ef;
  --surface: #fffdf9;
  --sand: #f1e9de;
  --line: #e7ded2;
  --ink: #2f211b;
  --muted: #72635a;
  --espresso: #2b1c17;
  --accent: #a24e37;
  --accent-deep: #823c29;
  --accent-light: #f4e4db;
  --success: #315f46;
  --success-wash: #e8f0e8;
  --radius: 18px;
  --body-font: Onest, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display-font: Cormorant, Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 500 14px/1.55 var(--body-font); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent-deep); text-underline-offset: .23em; }
h1, h2, h3, p { margin: 0; }
img, video { display: block; max-width: 100%; }
svg { flex-shrink: 0; vertical-align: middle; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.icon { width: 20px; height: 20px; }
.sr-only {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 31px 19px 20px;
  overflow-y: auto;
  background: var(--espresso);
  color: #f8ecde;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1px 9px 44px;
  text-align: left;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #a46b53;
  border-radius: 12px;
  background: #482820;
  color: #f3bd98;
}
.brand-mark .icon { width: 23px; height: 23px; }
.brand-name { display: block; font: 600 24px/1.13 var(--display-font); letter-spacing: -.4px; }
.brand small, .brand-caption { display: block; margin-top: 4px; color: #c7aba0; font-size: 10px; letter-spacing: .1em; }
.side-label {
  display: block;
  margin: 0 12px 11px;
  color: #bba198;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.nav { display: grid; gap: 5px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #e2cdc2;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  transition: background-color .16s, color .16s, border-color .16s;
}
.nav-link .icon { width: 18px; height: 18px; }
.nav-link:hover { background: #3d2921; color: #fff8ee; }
.nav-link:is(.is-active, .active, [aria-current='page'], [aria-selected='true'], [data-active='true']) {
  border-color: #794936;
  background: #533126;
  color: #ffe5d3;
}
.sidebar :focus-visible { outline-color: #e4a382; }
.sidebar-bottom { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 17px 3px 2px; border-top: 1px solid #54392f; color: #e8cfc2; font-size: 12px; }
.sidebar-bottom .icon { width: 16px; height: 16px; }
.sidebar-bottom small { display: block; margin-top: 2px; color: #c7aba0; font-size: 10px; }
.sidebar-bottom a { color: inherit; }
.profile-dot { display: grid; flex: 0 0 33px; width: 33px; height: 33px; place-items: center; border: 1px solid #755044; border-radius: 50%; background: #482c22; }
.logout { display: grid; flex: 0 0 auto; width: 33px; height: 33px; margin-left: auto; padding: 0; place-items: center; border: 1px solid #795043; border-radius: 8px; background: transparent; color: inherit; }
.logout:hover { background: #533126; }

.main { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 12px clamp(24px, 4.3vw, 72px);
  border-bottom: 1px solid var(--line);
  background: #faf7f1;
}
.breadcrumb, .top-actions, .toolbar { display: flex; align-items: center; gap: 10px; }
.breadcrumb { color: var(--muted); font-size: 12px; }
.breadcrumb strong, .breadcrumb span:last-child { color: var(--ink); }
.breadcrumb .icon { width: 14px; height: 14px; }
.top-actions { justify-content: flex-end; flex-wrap: wrap; }
.top-actions .button.secondary { border-color: #dec4b2; background: #f4e8db; color: #663a2b; }
.top-actions .button.secondary:hover { border-color: #bd927d; background: #ecd9c8; }
.content { width: 100%; max-width: 1500px; margin-inline: auto; padding: 36px clamp(24px, 4.3vw, 72px) 48px; }
.hero-title, h1 { color: var(--ink); font: 600 clamp(37px, 4.2vw, 58px)/1.05 var(--display-font); letter-spacing: -.033em; }
.hero-title h1 { font: inherit; letter-spacing: inherit; }
.hero-text { max-width: 660px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.content > .eyebrow { display: block; margin-bottom: 9px; }
.hero, .page-heading { margin-bottom: 26px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 11px; }
.page-heading .eyebrow { margin-bottom: 7px; }
.hero-title:has(+ .dashboard-grid), .hero-text:has(+ .dashboard-grid), .hero-text:has(+ .page-grid), .hero-text:has(+ .panel) { margin-bottom: 27px; }
.eyebrow { color: var(--accent-deep); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr); align-items: end; gap: 19px; }
.card-section .section-head { min-height: 38px; margin-bottom: 10px; }
.member-card, .benefit-card { position: relative; min-width: 0; min-height: 282px; overflow: hidden; border-radius: 20px; isolation: isolate; }
.member-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 28px;
  border: 1px solid #614032;
  background: radial-gradient(ellipse at 88% -10%, #724632 0%, transparent 61%), linear-gradient(120deg, #291a16 9%, #3f241c 78%, #4b2c20);
  color: #fff1e1;
  box-shadow: 0 12px 28px #53322219;
}
.card-glow {
  position: absolute;
  z-index: -1;
  top: -91%;
  right: -35%;
  width: 95%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at center, transparent 0 21px, #edb38317 22px, transparent 23px 32px);
  transform: rotate(-12deg) skew(-8deg);
  pointer-events: none;
}
.member-top, .member-bottom { display: flex; align-items: flex-start; justify-content: space-between; gap: 13px; }
.member-top .eyebrow { color: #e4b8a0; }
.member-brand { display: flex; align-items: center; gap: 9px; font: 600 24px/1 var(--display-font); }
.member-brand small { display: block; margin-top: 5px; color: #e7c3b0; font: 500 10px/1.2 var(--body-font); }
.mini-mark { display: grid; flex: 0 0 33px; width: 33px; height: 33px; place-items: center; border: 1px solid #986349; border-radius: 8px; background: #63382a; color: #f0bc99; }
.mini-mark .icon { width: 19px; height: 19px; }
.card-sample { padding: 5px 9px; border: 1px solid #956a55; border-radius: 99px; color: #ffdfc9; font-size: 10px; font-weight: 700; }
.member-bottom { align-items: end; }
.member-card-personal { gap: 12px; }
.member-card a, .member-card .button { color: #fce6d5; }
.member-card .button { border-color: #96644e; background: #3c2119a0; }
.member-card .button:hover { background: #673a2b; }
.card-name { display: block; margin-top: 4px; color: #fff4e5; font: 600 clamp(20px, 2vw, 27px)/1.16 var(--display-font); overflow-wrap: anywhere; }
.card-code { display: block; margin-top: 6px; color: #e6beb0; font-size: 10px; font-weight: 700; letter-spacing: .05em; overflow-wrap: anywhere; }
.card-balance { display: flex; align-items: baseline; gap: 8px; }
.balance-value { display: inline-block; font: 500 clamp(38px, 4.3vw, 64px)/1 var(--display-font); letter-spacing: -.055em; font-variant-numeric: lining-nums tabular-nums; }
.balance-label { display: block; margin-top: 4px; color: #edd2c4; font-size: 12px; }
.qr-frame { display: grid; flex: 0 0 auto; min-width: 100px; min-height: 100px; padding: 6px; place-items: center; border: 1px solid #e9ddd0; border-radius: 12px; background: #fff; color: var(--espresso); box-shadow: 0 3px 11px #1a110c1a; }
.qr-frame :is(img, canvas, svg) { width: 91px; max-width: 100%; height: auto; }
.qr-frame canvas { width: 91px !important; height: auto !important; image-rendering: pixelated; }
.qr-frame:is(button):hover { border-color: #e3b7a2; }
.qr-placeholder { background: #f4e3d4; color: #5b3425; }
.qr-frame .icon { width: 35px; height: 35px; }
.member-qr-stack { display: grid; flex-shrink: 0; gap: 6px; }
.member-qr-stack .member-directions { min-height: 44px; gap: 5px; padding: 7px 8px; white-space: nowrap; }
.benefit-card {
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: 25px 27px;
  background: linear-gradient(135deg, #552e24, #291813);
  color: #fff7eb;
}
.benefit-photo {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  background: url('/assets/napoleon.webp') center 53% / cover;
  object-fit: cover;
  object-position: center 53%;
}
.benefit-card::before { position: absolute; inset: 0; z-index: 0; background: linear-gradient(0deg, #21110df2 0%, #2f1a12a6 38%, #2f1a121a 78%); content: ''; pointer-events: none; }
.benefit-copy { position: relative; z-index: 1; width: 100%; max-width: 375px; }
.benefit-edit { position: relative; z-index: 1; align-self: flex-end; margin-bottom: auto; }
.benefit-edit + .benefit-copy { padding-top: 14px; }
.benefit-card .eyebrow { margin-bottom: 7px; color: #ffe4cb; }
.benefit-card .eyebrow .icon { width: 15px; height: 15px; margin-right: 4px; }
.benefit-card h2, .benefit-card h3 { color: #fff8f0; font: 600 clamp(25px, 2.6vw, 34px)/1.12 var(--display-font); letter-spacing: -.025em; }
.benefit-card p:not(.eyebrow) { margin-top: 8px; color: #fff0df; font-size: 12px; }
.benefit-card a { color: #fff0df; }
.benefit-card h2, .benefit-description { overflow-wrap: anywhere; }
.benefit-description { white-space: pre-wrap; }
.member-card-personal + .benefit-card { margin-top: 20px; }

.actions-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(225px, 100%), 1fr)); gap: 13px; margin-top: 17px; }
.action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 80px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  transition: border-color .16s, background-color .16s, transform .16s;
}
.action-card:hover { border-color: #bd927d; background: #fffbf5; transform: translateY(-1px); }
.action-icon, .activity-icon { display: grid; flex: 0 0 auto; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: var(--accent-light); color: var(--accent-deep); }
.action-icon .icon, .activity-icon .icon { width: 18px; height: 18px; }
.action-copy { flex: 1 1 auto; }
.action-card strong, .action-card b { display: block; font-size: 13px; font-weight: 800; }
.action-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.action-card > .icon:last-child { width: 16px; height: 16px; margin-left: auto; color: var(--muted); }

.activity { margin-top: 31px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 13px; margin-bottom: 13px; }
.section-head h2, .section-title { font: 600 27px/1.2 var(--display-font); letter-spacing: -.027em; }
.section-head p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.section-head h2 .icon { width: 19px; height: 19px; margin-right: 5px; color: var(--accent-deep); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 16px; background: #f5efe5; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 16px; border-top: 1px solid #eee6db; font-size: 12px; white-space: nowrap; }
td:last-child, th:last-child { text-align: right; }
td strong { font-weight: 800; }
.activity-icon { display: inline-grid; width: 31px; height: 31px; margin-right: 8px; border-radius: 9px; vertical-align: middle; }
.activity-icon .icon { width: 15px; height: 15px; }
.transaction { display: inline-flex; align-items: center; }
.transaction small { display: block; margin-top: 3px; color: var(--muted); }
.delta { font-weight: 800; font-variant-numeric: tabular-nums; }
.positive, .delta-plus { color: var(--success); }
.negative, .delta-minus { color: var(--accent-deep); }

.page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.page-grid > .wide, .span-full { grid-column: 1 / -1; }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel h2 { margin-bottom: 13px; font: 600 24px/1.25 var(--display-font); letter-spacing: -.023em; }
.panel .section-head h2 { margin-bottom: 0; }
.panel h3 { margin-bottom: 8px; font-size: 15px; font-weight: 800; }
.panel > p { margin-bottom: 15px; color: var(--muted); }
.panel + .panel { margin-top: 15px; }
.page-grid > .panel + .panel { margin-top: 0; }
.operation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 17px; }
.operation-grid .panel { margin-top: 0; }
.toolbar { flex-wrap: wrap; }
.form-stack { display: grid; align-items: start; gap: 14px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.field { display: grid; align-content: start; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 800; }
.lookup-form { align-items: end; }
.lookup-form .field { flex: 1 1 200px; max-width: 450px; }
.field small, .help, .hint, .muted { color: var(--muted); font-weight: 500; }
.field small, .help, .hint { font-size: 12px; }
input:not([type='checkbox'], [type='radio']), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #d7c9bb;
  border-radius: 9px;
  background: #fffdf9;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
input::placeholder, textarea::placeholder { color: #786d65; opacity: 1; }
input[readonly], :is(input, select, textarea):disabled { background: #f5eee4; color: var(--muted); }
input[type='radio'], input[type='checkbox'] { accent-color: var(--accent-deep); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f4eee5;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color .16s, border-color .16s, color .16s;
}
.button .icon { width: 16px; height: 16px; }
.button.primary { background: var(--accent-deep); color: #fffaf2; }
.button.primary:not(:disabled):hover { background: #6b3022; }
.button.secondary { border-color: #d6c4b5; background: var(--surface); color: var(--ink); }
.button.secondary:not(:disabled):hover { border-color: #ac7d67; background: #f6eee3; }
.button.ghost { background: transparent; color: var(--accent-deep); }
.button.ghost:not(:disabled):hover { background: var(--accent-light); }
.button:disabled { opacity: .55; }
.button.danger { background: #f6e5df; color: #843f2b; }
.button:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 11px; }
.icon-button { display: inline-grid; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.icon-button:hover { background: var(--sand); }

.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 4px 9px; border-radius: 99px; background: var(--sand); color: #684d3e; font-size: 10px; font-weight: 800; line-height: 1.2; }
.pill .icon { width: 13px; height: 13px; }
.pill.success { background: var(--success-wash); color: var(--success); }
.pill.accent { background: var(--accent-light); color: var(--accent-deep); }
.empty { display: grid; justify-items: center; gap: 8px; padding: 32px 15px; color: var(--muted); text-align: center; }
.empty h2, .empty h3, .empty strong { color: var(--ink); }
.empty > .icon { width: 33px; height: 33px; margin-bottom: 3px; color: var(--accent-deep); }
.empty .button { margin-top: 11px; }
.alert { padding: 10px 13px; border: 1px solid #e3cdb5; border-radius: 10px; background: #faf0e2; color: #6d452c; font-size: 12px; }
.alert.error { border-color: #e8c5b9; background: #faebe6; color: #7f3426; }
.alert.success { border-color: #c7ddcc; background: var(--success-wash); color: var(--success); }
.balance-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid #e6d8ca; border-radius: 13px; background: #f5ece0; }
.waiter-lookup + .balance-strip { justify-content: start; margin-top: 14px; }
.balance-strip + [data-waiter-rewards] { margin-top: 15px; }
.balance-strip strong { color: var(--espresso); font-weight: 800; }
.balance-strip small { display: block; color: var(--muted); }
.balance-strip .listed-balance { margin-left: auto; }
.balance-strip .balance-value { font-size: 31px; }
.scanner { position: relative; display: grid; place-items: center; min-height: 160px; overflow: hidden; border: 1px dashed #ba9986; border-radius: 12px; background: #f8efe6; }
.scanner video { width: 100%; max-height: 346px; object-fit: contain; }
.scanner .icon { width: 30px; height: 30px; color: var(--accent-deep); }
.scanner-target { position: absolute; inset: 50% auto auto 50%; width: min(70%, 166px); aspect-ratio: 1; border: 1px solid #cf9b7b; border-radius: 12px; box-shadow: 0 0 0 150px #25150f40; transform: translate(-50%, -50%); pointer-events: none; }
.cards-list { display: grid; gap: 9px; list-style: none; margin: 0; padding: 0; }
.card-list-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.card-list-row > span:nth-child(2) { flex: 1 1 135px; min-width: 0; overflow-wrap: anywhere; }
.cards-list strong { font-weight: 800; }
.cards-list small { display: block; color: var(--muted); }
.listed-balance { color: var(--accent-deep); font-weight: 800; white-space: nowrap; }
.settings-panel { max-width: 535px; }
.form-note { padding: 9px 11px; border-radius: 9px; background: var(--sand); color: var(--muted); font-size: 12px; }
.form-error { margin-top: 9px; padding: 9px 11px; border: 1px solid #e8c5b9; border-radius: 9px; background: #faebe6; color: #7f3426; font-size: 12px; }
.form-stack .form-error { margin-top: 0; }

.modal, dialog { width: min(calc(100% - 32px), 470px); padding: 23px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 100px #25140c60; }
.modal::backdrop, dialog::backdrop { background: #2b1c17a0; }
.modal h2, dialog h2 { margin-bottom: 9px; font: 600 24px/1.2 var(--display-font); }
.modal .toolbar, dialog .toolbar { justify-content: end; margin-top: 15px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 11px; margin-bottom: 13px; }
.modal-head h2 { margin-bottom: 0; }
.modal-head .button { flex-shrink: 0; min-width: 34px; min-height: 34px; padding: 5px; }
.modal .member-card { min-height: 221px; padding: 16px; }
.modal > .form-note { margin-block: 10px; }
.modal > .card-code { color: var(--muted); }
.standalone { width: min(100% - 30px, 715px); margin: 0 auto; padding: clamp(25px, 6vw, 74px) 0 44px; }
.standalone-brand .brand { margin: 0 0 25px; }
.standalone-brand .brand-mark { border-color: #87533e; }
.standalone-brand .brand small { color: var(--muted); }
.standalone .page-heading { margin-bottom: 19px; }
.standalone .member-card { min-height: 268px; }
.standalone .qr-frame canvas { width: clamp(100px, 28vw, 145px) !important; }
.standalone td:first-child { white-space: normal; }
.standalone-code { color: var(--muted); }
.standalone-actions { margin-top: 13px; }
.gate { max-width: 469px; }
.gate .hero-title { font-size: clamp(32px, 6vw, 48px); }
.toast { position: fixed; z-index: 9; right: 23px; bottom: 23px; width: max-content; max-width: calc(100% - 46px); padding: 11px 15px; border: 1px solid #86624b; border-radius: 11px; background: var(--espresso); color: #fff5e8; box-shadow: 0 8px 28px #34221638; font-size: 13px; font-weight: 700; }
.print-card { display: none; overflow-wrap: anywhere; }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 211px minmax(0, 1fr); }
  .sidebar { padding-inline: 14px; }
  .member-card, .benefit-card { padding-inline: 20px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; z-index: 5; top: 0; flex-direction: row; align-items: center; justify-content: space-between; gap: 11px; height: auto; padding: 9px clamp(15px, 4vw, 32px); overflow: visible; }
  .brand { flex-shrink: 0; margin: 0; gap: 8px; }
  .brand-mark { flex-basis: 35px; width: 35px; height: 35px; border-radius: 9px; }
  .brand-mark .icon { width: 19px; height: 19px; }
  .brand-name { font-size: 20px; }
  .brand small, .brand-caption, .sidebar-bottom, .side-label { display: none; }
  .sidebar-bottom:has(.logout) { display: block; margin: 0; padding: 0; border: 0; }
  .sidebar-bottom > span { display: none; }
  .nav { display: flex; align-items: stretch; gap: 4px; }
  .nav-link { justify-content: center; gap: 6px; min-height: 37px; padding: 7px 9px; border-radius: 8px; font-size: 11px; white-space: nowrap; }
  .nav-link .icon { width: 15px; height: 15px; }
  .topbar { min-height: 60px; }
  .content { padding-top: 29px; }
}

@media (max-width: 620px) {
  .sidebar { flex-direction: column; align-items: stretch; gap: 8px; padding-block: 9px 8px; }
  .sidebar-bottom:has(.logout) { position: absolute; top: 9px; right: 15px; }
  .nav { width: 100%; overflow-x: auto; }
  .nav-link { flex: 1 0 max-content; }
  .topbar { min-height: 51px; padding: 8px 15px; }
  .top-actions .button { min-height: 34px; padding: 6px 9px; }
  .breadcrumb { gap: 5px; font-size: 11px; }
  .content { padding: 23px 15px 34px; }
  .hero-title, h1 { font-size: clamp(31px, 8vw, 43px); }
  .hero-text { margin-top: 6px; }
  .hero, .page-heading { margin-bottom: 19px; }
  .hero-title:has(+ .dashboard-grid), .hero-text:has(+ .dashboard-grid), .hero-text:has(+ .page-grid), .hero-text:has(+ .panel) { margin-bottom: 20px; }
  .dashboard-grid, .page-grid, .operation-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .member-card, .benefit-card { min-height: 239px; padding: 19px; border-radius: 16px; }
  .actions-row { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 12px; }
  .action-card { min-height: 61px; padding: 9px 12px; }
  .activity { margin-top: 24px; }
  .section-head h2, .section-title { font-size: 23px; }
  .section-head { flex-wrap: wrap; }
  th, td { padding-inline: 11px; }
  .panel { padding: 15px; }
  .lookup-form .field { flex-basis: 100%; }
  input:not([type='checkbox'], [type='radio']), select, textarea { font-size: 16px; }
  .toast { right: 11px; bottom: 11px; max-width: calc(100% - 22px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  @page { margin: 14mm; }
  html, body { min-width: 0; background: white; }
  body * { visibility: hidden; }
  body:has(.print-buffer) #app, body > dialog, body > dialog::backdrop { display: none; }
  .standalone:has(.print-card) > :not(.print-card) { display: none; }
  .print-card, .print-card * { visibility: visible; }
  .print-card {
    position: absolute;
    z-index: 10;
    inset: 0 auto auto 0;
    display: block;
    width: 85mm;
    min-height: 53mm;
    padding: 5mm;
    overflow: visible;
    border: 1px solid #372a22;
    border-radius: 3mm;
    background: white;
    color: #211913;
    break-inside: avoid;
  }
  .print-card h1 { margin: 0 0 1mm; font-size: 20pt; }
  .print-card p { margin: 1mm 0 0; font-size: 8pt; }
  .print-card > canvas { display: block; width: 26mm !important; height: auto !important; margin: 1mm 0; image-rendering: pixelated; }
  .print-card .no-print, .print-card .button, .print-card .card-glow { display: none; }
  .print-card .qr-frame { margin: 3mm 0 0; padding: 2mm; width: 28mm; box-shadow: none; }
  .print-card .qr-frame :is(img, canvas, svg) { width: 25mm; }
}

.auth-page { max-width: 560px; padding-top: clamp(28px, 7vh, 76px); }
.auth-panel { padding: clamp(23px, 5vw, 38px); box-shadow: 0 18px 64px #41271908; }
.auth-panel .hero-title { font-size: clamp(34px, 7vw, 44px); line-height: 1.05; }
.auth-panel .hero-text { margin-top: 13px; font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.auth-form { gap: 18px; margin-top: 24px; }
.auth-form > .button { width: 100%; min-height: 48px; margin-top: 2px; }
.auth-panel button:disabled { opacity: .6; }
.auth-consent { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.7; }
.auth-consent input { flex: 0 0 17px; width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); }
.auth-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.auth-links .button { min-height: 38px; padding: 8px 0; white-space: normal; text-align: left; }
.auth-message { margin-top: 15px; padding: 12px 14px; border-radius: 9px; background: var(--success-wash); color: var(--success); font-size: 13px; line-height: 1.5; }
.auth-footer { margin-top: 24px; color: var(--muted); text-align: center; font-size: 10px; letter-spacing: .03em; }
.auth-footer a { color: inherit; }
.member-account-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.member-account-header .standalone-brand { margin-bottom: 28px; }
.member-account { display: flex; align-items: center; gap: 12px; margin-top: 2px; color: var(--muted); font-size: 11px; }
.member-account > span { max-width: 240px; overflow-wrap: anywhere; }
.member-account .button { min-height: 34px; padding: 5px 8px; font-size: 11px; }
.record-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.record-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
[data-row-open] { cursor: pointer; }
[data-row-open]:focus-within { border-color: var(--accent); }
@media (hover: hover) {
  [data-row-open]:hover { border-color: var(--accent); background: var(--paper); }
}
.record-profile { display: flex; align-items: center; flex: 1 1 220px; gap: 11px; min-width: 0; overflow-wrap: anywhere; }
.record-profile .action-icon { flex-shrink: 0; }
.record-profile small, .record-expiry { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.card-list-row .record-detail { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.record-actions { display: flex; flex-wrap: wrap; gap: 7px; max-width: 100%; }
.record-actions .button { min-height: 34px; padding: 6px 10px; }
.record-actions :is([data-action="copy-listed-invite"], [data-action="share-listed-invite"]) { min-height: 44px; max-width: 100%; text-align: left; }
.invite-result .toolbar { margin-top: 0; }
.invite-result textarea { resize: vertical; min-height: 10rem; }
.invite-activation { display: grid; justify-items: center; gap: 10px; }
.invite-activation canvas { display: block; max-width: 100%; height: auto !important; image-rendering: pixelated; }
.invite-activation .toolbar { justify-content: center; }
.invite-qr-download[hidden] { display: none; }
.resident-membership { margin-top: 22px; }
.membership-progress { display: grid; gap: 7px; font-weight: 600; }
.membership-progress progress { width: 100%; height: 12px; accent-color: var(--accent); }
.resident-rules { margin-top: 22px; }
.resident-rules > h2 { margin-bottom: 12px; }
.resident-rules-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.resident-rule { display: flex; align-items: flex-start; gap: 11px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.resident-rule h3 { margin: 0 0 4px; font-size: 14px; font-weight: 800; }
.resident-rule p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.resident-rule-examples { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 7px; color: var(--accent-deep); font-size: 12px; }
.resident-rule-examples > span { white-space: nowrap; }
@media (min-width: 660px) {
  .resident-rules-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .resident-rule { display: grid; gap: 9px; }
}
.invite-separate summary { cursor: pointer; font-size: .875rem; font-weight: 600; }
.invite-separate[open] > :not(summary) { margin-top: .75rem; }
.journal-filter { max-width: 270px; margin-bottom: 16px; }
@media (max-width: 900px) {
  .sidebar .nav { min-width: 0; overflow-x: auto; }
  .sidebar .nav-link { flex-shrink: 0; }
  .sidebar-bottom:has(.logout) { flex-shrink: 0; }
}
@media (max-width: 540px) {
  .auth-page { padding-right: 16px; padding-left: 16px; }
  .auth-page .standalone-brand { margin-left: 4px; }
  .member-account-header { flex-wrap: wrap; gap: 0; margin-bottom: 22px; }
  .member-account-header .standalone-brand { width: 100%; margin-bottom: 14px; }
  .member-account { width: 100%; justify-content: space-between; }
}
@media print { .member-account { display: none !important; } }

.cabinet-tabs,
.cabinet-mobile-heading,
.resident-profile-screen {
  display: none;
}

.resident-view-profile .resident-profile-screen { display: block; }
:is(.resident-view-profile, .resident-view-guests) :is(.resident-card-screen, .resident-history-screen) { display: none; }

.resident-guest {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 1fr) auto;
}
.resident-guest-progress { font-size: 12px; }
.resident-guest-bonus { text-align: end; }
.resident-guest-bonus small { display: block; color: var(--muted); font-size: 11px; }

@media (max-width: 540px) {
  .resident-guest { grid-template-columns: minmax(0, 1fr) auto; }
  .resident-guest-progress { grid-area: 2 / 1 / auto / -1; }
}

.cabinet-breadcrumb-prefix {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cabinet-more-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr));
  gap: 10px;
}

.cabinet-more-grid .action-card { min-width: 0; }
.cabinet-account { max-width: 640px; }
.cabinet-account-details { margin: 20px 0; }
.cabinet-account-details dt { color: var(--muted); font-size: 12px; }
.cabinet-account-details dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.cabinet-account-actions { flex-wrap: wrap; }
.cabinet-account-actions .button { min-height: 44px; }
.card-resident-profile { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.card-resident-profile h3 { margin: 0 0 8px; }
.card-resident-profile .cabinet-account-details { margin: 0; }
.card-resident-profile .cabinet-account-details dd + dt { margin-top: 8px; }
.installation-steps { display: grid; gap: 12px; margin: 0; padding-left: 20px; }
.auth-footer { display: grid; justify-items: center; gap: 12px; }
.auth-footer .button { min-height: 44px; }

@media screen {
  .cabinet-compact {
    --cabinet-tabs-space: calc(68px + env(safe-area-inset-bottom, 0px));
  }

  .cabinet-compact .cabinet-tabs {
    position: fixed;
    z-index: 8;
    inset: auto 0 0;
    display: block;
    padding: 5px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    border-top: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 -8px 24px #2b1c1711;
  }

  .cabinet-tabs-inner {
    display: flex;
    gap: 4px;
    max-width: 600px;
    margin-inline: auto;
  }

  .cabinet-tab {
    display: grid;
    flex: 1 1 0;
    justify-items: center;
    align-content: center;
    gap: 4px;
    min-width: 0;
    min-height: 56px;
    padding: 5px 2px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.15;
    text-align: center;
    touch-action: manipulation;
  }

  .cabinet-tab .icon { width: 21px; height: 21px; }
  .cabinet-tab:hover { background: var(--sand); }
  .cabinet-tab[aria-current="page"] { background: var(--accent-light); color: var(--accent-deep); }
  .cabinet-tab:focus-visible { outline-offset: -3px; }

  .cabinet-compact .cabinet-shell { display: block; }
  .cabinet-compact .cabinet-shell .sidebar {
    position: static;
    height: auto;
    padding: calc(10px + env(safe-area-inset-top, 0px)) max(15px, env(safe-area-inset-right, 0px)) 10px max(15px, env(safe-area-inset-left, 0px));
  }
  .cabinet-compact .cabinet-shell .sidebar .brand { margin: 0; }
  .cabinet-compact .cabinet-shell .sidebar :is(.nav, .side-label, .sidebar-bottom),
  .cabinet-compact .cabinet-breadcrumb-prefix,
  .cabinet-compact .resident-cabinet .member-account,
  .cabinet-compact .cabinet-desktop-heading,
  .cabinet-compact .cabinet-other-operation {
    display: none;
  }

  .cabinet-compact .cabinet-shell .topbar {
    padding-inline: max(15px, env(safe-area-inset-left, 0px)) max(15px, env(safe-area-inset-right, 0px));
  }
  .cabinet-compact .cabinet-shell .content {
    padding-inline: max(15px, env(safe-area-inset-left, 0px)) max(15px, env(safe-area-inset-right, 0px));
    padding-bottom: calc(24px + var(--cabinet-tabs-space));
  }
  .cabinet-compact .resident-cabinet {
    padding: calc(18px + env(safe-area-inset-top, 0px)) 0 calc(24px + var(--cabinet-tabs-space));
  }
  .cabinet-compact .resident-cabinet .member-account-header,
  .cabinet-compact .resident-cabinet .standalone-brand,
  .cabinet-compact .resident-cabinet .standalone-brand .brand {
    margin-bottom: 0;
  }
  .cabinet-compact .resident-cabinet .member-account-header { margin-bottom: 15px; }
  .cabinet-compact .resident-cabinet .page-heading { margin-bottom: 14px; }
  .cabinet-compact .resident-cabinet .member-card { min-height: 220px; }
  .cabinet-compact .resident-history-screen .activity { margin-top: 0; }
  .cabinet-compact .resident-cabinet:not(.resident-view-home) .resident-card-screen,
  .cabinet-compact .resident-cabinet:not(.resident-view-history) .resident-history-screen {
    display: none;
  }
  .cabinet-compact .cabinet-mobile-heading {
    display: block;
  }
  .cabinet-compact .operation-grid:has(.cabinet-other-operation) { grid-template-columns: minmax(0, 1fr); }
  .cabinet-compact .waiter-lookup [data-action="scan"] { min-height: 44px; }
  .cabinet-compact:has(.cabinet-tabs) .toast {
    bottom: calc(12px + var(--cabinet-tabs-space));
    right: max(11px, env(safe-area-inset-right, 0px));
  }
  .cabinet-compact .auth-page {
    padding-top: calc(clamp(24px, 7vh, 76px) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }
}

@media print {
  .cabinet-tabs { display: none !important; }
}
