:root {
  --ink: #111411;
  --muted: #667069;
  --line: #dfe4df;
  --surface: #ffffff;
  --surface-2: #f3f5f2;
  --black: #0b0d0b;
  --green: #bfff1c;
  --green-dark: #2f6b25;
  --teal: #1d7f78;
  --coral: #d96c55;
  --gold: #b2832f;
  --blue: #476f99;
  --danger: #b8393f;
  --shadow: 0 18px 50px rgba(10, 18, 11, .08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--surface-2); font-family: "DM Sans", sans-serif; font-size: 15px; line-height: 1.5; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { display: block; max-width: 100%; }
svg { width: 18px; height: 18px; stroke-width: 2; }
[hidden] { display: none !important; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Manrope", sans-serif; letter-spacing: 0; }
h1 { margin-bottom: 10px; font-size: 46px; line-height: 1.08; }
h2 { margin-bottom: 8px; font-size: 22px; line-height: 1.2; }
h3 { font-size: 16px; }

.eyebrow { margin-bottom: 8px; color: var(--teal); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.public-main { min-height: 100vh; }
.app-main { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 80px; }

.app-header { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr); align-items: center; min-height: 72px; padding: 0 28px; color: white; background: var(--black); border-bottom: 1px solid rgba(255,255,255,.1); }
.brand, .public-brand { display: inline-flex; gap: 14px; align-items: center; width: fit-content; color: inherit; text-decoration: none; font-family: "Manrope", sans-serif; font-weight: 800; }
.brand img { width: 38px; height: 38px; object-fit: contain; }
.brand span { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.2); }
.main-nav { display: flex; align-items: center; height: 100%; }
.main-nav a { display: inline-flex; gap: 8px; align-items: center; height: 72px; padding: 0 20px; color: #aeb6af; text-decoration: none; font-weight: 700; border-bottom: 3px solid transparent; }
.main-nav a:hover, .main-nav a.active { color: white; border-bottom-color: var(--green); }
.user-menu { display: flex; gap: 14px; justify-self: end; align-items: center; }
.user-menu > div { display: grid; text-align: right; }
.user-menu strong { font-size: 13px; }
.user-menu span { color: #aab2ab; font-size: 11px; }

.icon-button { display: inline-grid; place-items: center; width: 40px; min-width: 40px; height: 40px; padding: 0; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.app-header .icon-button { border-color: rgba(255,255,255,.2); }
.icon-button:hover { background: rgba(127,127,127,.09); }
.icon-button.approve { color: var(--green-dark); background: #edf9e9; border-color: #b9dbb2; }
.icon-button.reject { color: var(--danger); background: #fff0ee; border-color: #edc1ba; }

.button { display: inline-flex; gap: 9px; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-weight: 800; cursor: pointer; }
.button:hover { border-color: #9aa59d; }
.button.primary { color: #0b1007; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: #aeea15; border-color: #aeea15; }
.button.ghost { background: transparent; }
.button.wide { width: 100%; }
.button.compact { min-height: 40px; padding: 0 14px; }
.button:disabled { opacity: .55; cursor: wait; }

.login-shell { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(430px, .65fr); min-height: 100vh; background: var(--black); }
.login-visual { min-height: 100vh; background: url('/assets/img/login-club.jpg') center / cover no-repeat; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 6vw, 84px); background: #f8faf7; }
.login-brand { position: absolute; top: 34px; display: flex; gap: 14px; align-items: center; font-family: "Manrope", sans-serif; font-weight: 800; }
.login-brand img { width: 38px; height: 38px; object-fit: contain; }
.login-brand span { padding-left: 14px; border-left: 1px solid #cfd5cf; }
.login-copy { max-width: 520px; margin-bottom: 32px; }
.login-copy h1 { font-size: 52px; }
.login-copy > p:last-child { max-width: 420px; color: var(--muted); }
.form-stack { display: grid; gap: 18px; max-width: 500px; }
label { display: grid; gap: 7px; color: #303630; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; color: var(--ink); background: white; border: 1px solid #cfd6d0; border-radius: 6px; outline: none; }
input, select { min-height: 48px; padding: 0 14px; }
textarea { padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(29,127,120,.12); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 52px; }
.password-field .icon-button { position: absolute; top: 4px; right: 4px; border: 0; }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.login-footer { display: flex; gap: 10px; margin-top: 32px; color: var(--muted); }
.login-footer a { color: var(--teal); font-weight: 800; }

.public-header { display: flex; align-items: center; justify-content: space-between; padding: 24px clamp(24px, 6vw, 80px); background: white; border-bottom: 1px solid var(--line); }
.public-brand img { width: 36px; height: 36px; object-fit: contain; }
.public-brand span { padding-left: 14px; border-left: 1px solid var(--line); }
.application-page { min-height: 100vh; padding-bottom: 80px; }
.application-intro, .application-form, .application-success { width: min(880px, calc(100% - 40px)); margin-inline: auto; }
.application-intro { padding: 70px 0 28px; }
.application-intro p:last-child { max-width: 660px; color: var(--muted); font-size: 17px; }
.application-form { position: relative; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.progress-line { height: 4px; background: #e8ece8; }
.progress-line span { display: block; width: 33.333%; height: 100%; background: var(--teal); transition: width .25s ease; }
.form-step { display: none; min-height: 430px; padding: 42px; }
.form-step.active { display: block; animation: step-in .22s ease both; }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step-label { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.form-step h2 { margin-bottom: 28px; font-size: 28px; }
.field-grid { display: grid; gap: 18px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-step > label { margin-top: 18px; }
.step-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 34px; }
.upload-field { padding: 22px; background: var(--surface-2); border: 1px dashed #aab6ad; border-radius: 6px; cursor: pointer; }
.upload-field input { position: absolute; opacity: 0; pointer-events: none; }
.upload-field span { display: flex; justify-content: space-between; }
.upload-field small { color: var(--muted); font-weight: 500; }
.upload-field strong { width: fit-content; color: var(--teal); }
.honey { position: absolute; left: -9999px; }
.application-success { padding: 80px 0; text-align: center; }
.application-success p { max-width: 560px; margin-inline: auto; color: var(--muted); }
.success-icon { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 22px; color: #1d5f1a; background: #e7f7df; border-radius: 50%; }
.success-icon svg { width: 30px; height: 30px; }

.page-heading { display: flex; gap: 30px; align-items: flex-end; justify-content: space-between; margin-bottom: 30px; }
.page-heading h1 { margin-bottom: 7px; }
.page-heading > div > p:last-child { margin-bottom: 0; color: var(--muted); }
.header-actions { display: flex; gap: 10px; align-items: center; }
.membership-card { display: flex; gap: 12px; align-items: center; min-width: 270px; padding: 16px 18px; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(11,20,12,.05); }
.membership-card > div { display: grid; flex: 1; }
.membership-card span { color: var(--muted); font-size: 12px; }
.membership-card > svg { color: var(--green-dark); }
.status-dot { width: 10px; height: 10px; background: #3ea43b; border: 3px solid #dff2da; border-radius: 50%; box-sizing: content-box; }

.catalog-toolbar { display: grid; grid-template-columns: minmax(280px, 1fr) auto; gap: 16px; margin-bottom: 24px; }
.search-field { position: relative; }
.search-field svg { position: absolute; top: 15px; left: 15px; color: var(--muted); }
.search-field input { padding-left: 45px; }
.segments { display: flex; gap: 4px; align-items: center; padding: 4px; overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 7px; }
.segments button { height: 40px; padding: 0 14px; color: var(--muted); white-space: nowrap; background: transparent; border: 0; border-radius: 5px; font-weight: 700; cursor: pointer; }
.segments button.active { color: white; background: var(--black); }
.offer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.offer-card { display: grid; grid-template-rows: 138px 1fr; min-height: 390px; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: var(--radius); transition: transform .18s ease, box-shadow .18s ease; }
.offer-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.offer-brand { position: relative; display: flex; align-items: flex-end; justify-content: space-between; padding: 20px; color: white; }
.offer-brand span { display: grid; place-items: center; width: 58px; height: 58px; color: var(--ink); background: white; border-radius: 6px; font-family: "Manrope", sans-serif; font-size: 26px; font-weight: 800; }
.offer-brand img { width: 68px; height: 68px; padding: 5px; object-fit: contain; background: white; border-radius: 6px; }
.offer-brand small { padding: 5px 8px; background: rgba(0,0,0,.28); border-radius: 4px; font-weight: 700; }
.visual-1 { background: #1d7f78; } .visual-2 { background: #a34d43; } .visual-3 { background: #3f6387; } .visual-4 { background: #79672c; } .visual-5 { background: #355f35; } .visual-6 { background: #674b70; }
.offer-body { display: flex; flex-direction: column; padding: 22px; }
.discount-badge { width: fit-content; margin-bottom: 14px; padding: 5px 8px; color: #234c19; background: #e7f8df; border-radius: 4px; font-size: 12px; font-weight: 800; }
.offer-body h2 { margin-bottom: 4px; font-size: 20px; }
.offer-body p { color: var(--muted); }
.offer-body .partner-name { margin-bottom: 16px; color: #363d37; font-size: 12px; font-weight: 700; }
.offer-actions { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.offer-actions .button { flex: 1; }
.empty-state { grid-column: 1 / -1; padding: 50px; text-align: center; }

.modal { width: min(500px, calc(100% - 30px)); padding: 0; overflow: visible; background: white; border: 0; border-radius: var(--radius); box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.modal::backdrop { background: rgba(4,8,5,.72); backdrop-filter: blur(4px); }
.modal-close { position: absolute; z-index: 2; top: 14px; right: 14px; background: white; }
.modal-content { padding: 36px; text-align: center; }
.modal-content h2 { margin-top: 12px; }
.modal-content > p { color: var(--muted); }
.qr-box { display: grid; place-items: center; width: 210px; height: 210px; margin: 24px auto 16px; padding: 15px; background: white; border: 1px solid var(--line); }
.qr-box img, .qr-box canvas { width: 180px !important; height: 180px !important; }
.code-display { font-family: "Manrope", sans-serif; font-size: 34px; font-weight: 800; letter-spacing: 0; }
.timer { color: var(--coral); font-weight: 800; }
.rules-panel { padding: 34px; }
.rules-panel p { color: var(--muted); }
.rules-panel .terms { margin-top: 24px; padding-top: 18px; color: var(--ink); border-top: 1px solid var(--line); }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stats-grid article { display: grid; grid-template-columns: 44px 1fr auto; grid-template-rows: auto auto; align-items: center; padding: 20px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.stats-grid article > svg { grid-row: 1 / 3; display: grid; place-items: center; width: 40px; height: 40px; padding: 10px; color: var(--teal); background: #e5f2f0; border-radius: 6px; }
.stats-grid article span { color: var(--muted); font-size: 12px; }
.stats-grid article strong { grid-column: 3; grid-row: 1 / 3; font-family: "Manrope", sans-serif; font-size: 30px; }
.admin-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.terminal-section, .admin-band, .table-section, .offer-management, .recent-uses { padding: 26px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.terminal-section { margin-bottom: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-heading h2 { margin: 0; }
.section-heading .eyebrow { margin-bottom: 3px; }
.section-heading > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.live-indicator { display: inline-flex; gap: 8px; align-items: center; color: var(--green-dark); font-size: 12px; font-weight: 800; }
.live-indicator span { width: 8px; height: 8px; background: #4bab42; border-radius: 50%; }
.code-form { display: grid; grid-template-columns: minmax(250px, 1fr) auto; gap: 12px; align-items: end; max-width: 720px; }
.code-form input { font-family: "Manrope", sans-serif; font-size: 24px; font-weight: 800; text-transform: uppercase; letter-spacing: 0; }
.lookup-result { margin-top: 20px; max-width: 720px; padding: 20px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; }
.lookup-result .lookup-row { display: flex; gap: 18px; align-items: center; }
.lookup-result .lookup-row > div { display: grid; flex: 1; }
.lookup-result span { color: var(--muted); }
.split-section { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, .6fr); gap: 18px; }
.partner-offers { display: grid; gap: 8px; }
.partner-offers article { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.partner-offers article > div { display: grid; }
.partner-offers article > div span { color: var(--muted); font-size: 12px; }
.inline-form { display: grid; gap: 14px; margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.inline-form h3 { margin-bottom: 0; }
.inline-form .button { width: fit-content; }
.recent-uses article { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.recent-uses article > div { display: grid; }
.recent-uses article span, .recent-uses time { color: var(--muted); font-size: 12px; }
.avatar-small { display: grid; place-items: center; width: 36px; height: 36px; color: white !important; background: var(--teal); border-radius: 50%; font-weight: 800; }

.queue-chip { display: inline-flex; gap: 7px; align-items: center; min-height: 42px; padding: 0 13px; color: #6a4d16; background: #fff6df; border: 1px solid #ead9a7; border-radius: 6px; font-size: 12px; font-weight: 800; }
.admin-band { margin-bottom: 18px; }
.moderation-list { display: grid; }
.moderation-list > article { display: grid; grid-template-columns: 52px minmax(260px, 1.2fr) minmax(210px, .8fr) auto; gap: 16px; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); }
.application-logo { display: grid; place-items: center; width: 48px; height: 48px; overflow: hidden; color: white; background: var(--teal); border-radius: 6px; font-family: "Manrope", sans-serif; font-size: 20px; font-weight: 800; }
.application-logo img { width: 100%; height: 100%; object-fit: contain; background: white; }
.moderation-main, .moderation-contact { display: grid; }
.moderation-main span, .moderation-contact span { color: var(--muted); font-size: 12px; }
.moderation-main p { margin: 6px 0 0; }
.moderation-actions { display: flex; gap: 7px; }
.compact-list > article { grid-template-columns: 52px minmax(260px, 1fr) auto; }

.table-section { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
td { font-size: 13px; }
code { padding: 4px 7px; background: var(--surface-2); border-radius: 4px; font-weight: 800; }
.status { display: inline-flex; align-items: center; min-height: 26px; padding: 0 8px; border-radius: 4px; font-size: 11px; font-weight: 800; }
.status-active, .status-published, .status-confirmed, .status-approved { color: #285824; background: #e5f5e0; }
.status-pending { color: #70531e; background: #fff2d7; }
.status-expired, .status-rejected { color: #8a3135; background: #fde8e6; }
.empty-cell { padding: 30px 12px !important; color: var(--muted); text-align: center; }
.not-found { display: grid; place-items: center; min-height: 70vh; text-align: center; }
.not-found strong { color: var(--teal); font-size: 72px; }
.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 420px; padding: 14px 18px; color: white; background: var(--black); border-radius: 6px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }

@media (max-width: 1050px) {
  .app-header { grid-template-columns: 1fr auto; }
  .main-nav { position: fixed; z-index: 30; right: 20px; bottom: 18px; left: 20px; justify-content: center; height: 58px; background: var(--black); border: 1px solid rgba(255,255,255,.16); border-radius: 8px; box-shadow: 0 14px 50px rgba(0,0,0,.2); }
  .main-nav a { height: 56px; }
  .user-menu { grid-column: 2; }
  .offer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .moderation-list > article { grid-template-columns: 52px 1fr auto; }
  .moderation-contact { display: none; }
}

@media (max-width: 760px) {
  .app-main { width: calc(100% - 28px); max-width: 720px; padding-top: 28px; padding-bottom: 100px; }
  .app-header { min-height: 64px; padding: 0 14px; }
  .brand span { display: none; }
  .user-menu > div { display: none; }
  .login-shell { display: block; background: #f8faf7; }
  .login-visual { min-height: 34vh; background-position: 35% center; }
  .login-panel { min-height: 66vh; padding: 54px 22px 34px; }
  .login-brand { position: absolute; top: calc(34vh + 16px); }
  .login-copy { margin-top: 38px; }
  .login-copy h1 { font-size: 33px; }
  .public-header { padding: 16px; }
  .public-brand span { display: none; }
  .application-intro { padding-top: 44px; }
  .form-step { min-height: 500px; padding: 26px 20px; }
  .field-grid.two, .catalog-toolbar, .split-section { grid-template-columns: 1fr; }
  .step-actions { justify-content: stretch; }
  .step-actions .button { flex: 1; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading h1 { font-size: 34px; }
  .membership-card { width: 100%; }
  .header-actions { align-items: stretch; flex-direction: column; }
  .offer-grid { grid-template-columns: 1fr; }
  .offer-card { min-height: 360px; }
  .stats-grid, .admin-stats { grid-template-columns: 1fr; }
  .code-form { grid-template-columns: 1fr; }
  .moderation-list > article, .compact-list > article { grid-template-columns: 44px 1fr; align-items: start; }
  .moderation-actions { grid-column: 2; }
  .application-logo { width: 42px; height: 42px; }
  .table-wrap { width: 100%; max-width: 100%; }
  table { min-width: 620px; }
  .modal-content { padding: 30px 20px; }
  .toast { right: 14px; bottom: 86px; left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
