/* =========================
   STRETCH / Ron Physio UI
   Screenshot-inspired theme
========================= */

:root {
  --warm-grey: #a9a39f;
  --warm-grey-light: #d8d6d4;
  --page-grey: #e5e5e5;
  --blue-bg: #3b82f6;
  --blue-bg-dark: #1d4ed8;
  --card-white: #f7f7f7;
  --pure-white: #ffffff;
  --black: #171717;
  --text-dark: #171717;
  --text-muted: #5f5f5f;
  --border-soft: #d6d2cf;
  --success-bg: #edf7ee;
  --success-text: #286b35;
  --error-bg: #fff0f0;
  --error-text: #9a2525;
  --radius-large: 14px;
  --radius-card: 18px;
  --shadow-card: 0 18px 45px rgba(0, 0, 0, 0.22);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* =========================
   ADMIN ROLE BADGES
   ========================= */

.role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.super-admin {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.role-badge.admin {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.admin-row.empty-row {
  grid-template-columns: 1fr;
  text-align: center;
  padding: 24px 16px;
}

/* =========================
   END OF STYLESHEET
   ========================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text-dark);
  background: var(--warm-grey);
}

body[data-page="login"] {
  background: #000000;
  position: relative;
}

/* Fixed, full-bleed background photo at 20% opacity over black.
   position: fixed + inset: 0 + background-size: cover keeps it
   covering the entire viewport with no edges/borders on resize. */
body[data-page="login"]::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("images/Strech_login_page.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.2;
  z-index: 0;
}

body {
  min-height: 100vh;
}

button,
a,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  text-decoration: none;
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.muted-text,
.helper-text {
  color: var(--text-muted);
}

.helper-text {
  font-size: 0.88rem;
  margin-bottom: 0;
}

/* =========================
   BUTTONS
========================= */

.primary-button,
.secondary-button,
.mini-button,
.btn,
.btn-primary,
.btn-light,
.btn-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 0;
  min-height: 48px;
  padding: 12px 24px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.primary-button,
.btn-primary,
.btn-dark {
  background: var(--black);
  color: var(--pure-white);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.18);
}

.secondary-button,
.btn-light {
  background: #eeeeee;
  color: var(--black);
  border: 1px solid #d7d7d7;
}

.primary-button:hover,
.secondary-button:hover,
.mini-button:hover,
.btn:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.primary-button:active,
.secondary-button:active,
.mini-button:active,
.btn:active {
  transform: translateY(0);
}

.wide-button,
.full-width {
  width: 100%;
}

.mini-button,
.btn-small {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 0.82rem;
  border-radius: 7px;
  background: var(--black);
  color: var(--pure-white);
}

/* =========================
   TOP HEADER
========================= */

.top-bar,
.checkin-header,
.topbar {
  min-height: 104px;
  padding: 18px 9vw;
  background: var(--warm-grey);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.top-bar h1,
.checkin-header h1,
.topbar h1,
.brand-title,
.spaced {
  margin: 0;
  font-size: 1.65rem;
  letter-spacing: 0.38em;
  font-weight: 900;
}

.top-bar p,
.checkin-header p,
.topbar p,
.brand-tagline {
  margin: 8px 0 0;
  color: rgba(0, 0, 0, 0.72);
  font-size: 1rem;
}

.header-actions,
.modal-actions,
.row-actions,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Optional nav, if your HTML has it */
.site-nav {
  background: rgba(245, 245, 245, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 0;
  display: flex;
  overflow: hidden;
}

.site-nav a {
  padding: 16px 24px;
  color: var(--black);
  font-size: 0.95rem;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.65);
}

/* =========================
   LOGIN PAGE
========================= */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: transparent;
  position: relative;
  z-index: 1;
}

.brand-panel,
.brand-block {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 64px 7vw;
  color: var(--pure-white);
}

.brand-mark {
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 0.9;
}

.brand-panel p,
.brand-block p {
  font-size: 1.25rem;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.9);
}

.card,
.login-card,
.dashboard-card,
.small-card,
.history-card,
.client-placeholder-card {
  background: var(--card-white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.login-card,
.auth-card {
  align-self: center;
  justify-self: center;
  width: min(440px, calc(100% - 36px));
  padding: 40px;
  background: rgba(247, 247, 247, 0.96);
}

.login-card h2,
.auth-card h2 {
  margin-bottom: 8px;
  font-size: 2.2rem;
  letter-spacing: -0.04em;
}

.portal-card,
.auth-stack {
  width: min(760px, calc(100% - 36px));
}

.portal-action-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.card-meta-list {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.auth-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.auth-panel h1,
.auth-panel h2 {
  margin-bottom: 8px;
}

.auth-divider {
  padding-left: 24px;
  border-left: 1px solid var(--border-soft);
}

.compact-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.single-column-actions {
  grid-template-columns: 1fr;
}

label {
  display: block;
  margin: 18px 0 8px;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

input {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: var(--pure-white);
  color: var(--text-dark);
  font-size: 1rem;
}

input:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.08);
}

select {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: var(--pure-white);
  color: var(--text-dark);
  font-size: 1rem;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.08);
}

.login-card .primary-button,
.auth-card .primary-button,
.auth-card .btn-primary {
  width: 100%;
  margin-top: 22px;
}

/* =========================
   DASHBOARD / ADMIN PAGES
========================= */

.page-section,
.content-section {
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
  padding: 56px 0 76px;
}

.page-title,
.section-heading {
  margin-bottom: 30px;
}

.page-title h2,
.section-heading h1 {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  margin-bottom: 12px;
}

.page-title p,
.section-heading p {
  max-width: 720px;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 1.05rem;
}

.dashboard-grid,
.admin-action-grid,
.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.dashboard-card {
  padding: 34px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  color: var(--black);
  text-align: left;
}

.dashboard-card h3,
.small-card h3,
.history-card h3 {
  font-size: 1.55rem;
  margin-bottom: 10px;
  letter-spacing: -0.03em;
}

.dashboard-card p,
.small-card p,
.history-card p {
  color: var(--text-muted);
  line-height: 1.55;
}

.small-card,
.history-card,
.client-placeholder-card {
  padding: 28px;
}

/* =========================
   CHECK-IN PAGE
   More like uploaded screenshot
========================= */

body[data-page="checkin"] {
  background: var(--page-grey);
  overflow: hidden;
  height: 100vh;
}

body[data-page="checkin"] .top-bar,
body[data-page="checkin"] .checkin-header {
  min-height: auto;
  padding: 14px 7vw;
}

.checkin-header {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
}

.checkin-layout {
  height: calc(100vh - 70px);
  padding: 18px 4vw 28px;
  display: grid;
  grid-template-columns: minmax(0, 620px);
  justify-content: center;
  gap: 18px;
  background:
    linear-gradient(
      90deg,
      rgba(43, 18, 8, 0.72),
      rgba(10, 10, 10, 0.78)
    ),
    url("clinic-bg.jpg") center / cover no-repeat,
    #242424;
  overflow: hidden;
}

/* If you only want one centered card like the screenshot,
   uncomment this block and hide scanner side visually. */

/*
.checkin-layout {
  display: flex;
  justify-content: center;
  align-items: center;
}

.scanner-panel {
  display: none;
}

.phone-panel {
  width: min(540px, 100%);
}
*/

.checkin-panel {
  background: rgba(247, 247, 247, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: clamp(14px, 2vw, 28px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel-header h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 6px;
}

.panel-header p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.phone-display {
  min-height: 48px;
  margin: 10px 0 10px;
  padding: 10px 14px;
  border-radius: 11px;
  background: var(--pure-white);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.phone-placeholder {
  color: #999999;
  font-weight: 500;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.keypad button {
  min-height: clamp(36px, 5.5vh, 52px);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--pure-white);
  color: var(--black);
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 800;
  cursor: pointer;
}

.keypad button:hover {
  background: #f0f0f0;
}

.keypad button:active {
  transform: scale(0.98);
}

.key-secondary,
.secondary-key {
  font-size: 1rem !important;
  color: var(--text-muted) !important;
}

.scanner-panel {
  justify-content: space-between;
  overflow: hidden;
  background: rgba(247, 247, 247, 0.96);
}

.scanner-box {
  flex: 0 1 auto;
  width: min(100%, 58vh, 520px);
  aspect-ratio: 1 / 1;
  min-height: 0;
  border-radius: 12px;
  background:
    linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)),
    #1f1f1f;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0 8px;
  align-self: center;
  overflow: hidden;
}

.scanner-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  max-height: 100%;
  min-height: 0;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  color: var(--pure-white);
  text-align: center;
  padding: 14px;
  overflow: hidden;
}

.scanner-live-area {
  width: 100%;
  aspect-ratio: 1 / 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.qr-reader {
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
  position: relative;
  flex-shrink: 1;
}

.qr-reader video {
  border-radius: 12px;
  width: 100%;
  height: auto;
  display: block;
}

.qr-reader img[alt="Info icon"] {
  display: none;
}

/* Style the qr-reader container — let the library manage its internal layout */
#qrReader {
  width: 100% !important;
  height: auto !important;
}

#qrReader video {
  border-radius: 12px !important;
}

/* Ensure text in the scanner panel area is visible on the light card background */
#scannerStatus {
  color: var(--text-dark);
}

/* Visual flash when QR code is detected */
.scanner-frame.qr-flash {
  border-color: #00ff88 !important;
  box-shadow: 0 0 30px rgba(0, 255, 136, 0.5), inset 0 0 30px rgba(0, 255, 136, 0.15);
  transition: border-color 0.05s, box-shadow 0.05s;
}

.scanner-frame > span {
  position: absolute;
  width: 42px;
  height: 42px;
  border-color: var(--pure-white);
  border-style: solid;
}

.scanner-frame > span:nth-child(1) {
  top: 18px;
  left: 18px;
  border-width: 4px 0 0 4px;
}

.scanner-frame > span:nth-child(2) {
  top: 18px;
  right: 18px;
  border-width: 4px 4px 0 0;
}

.scanner-frame > span:nth-child(3) {
  bottom: 18px;
  right: 18px;
  border-width: 0 4px 4px 0;
}

.scanner-frame > span:nth-child(4) {
  bottom: 18px;
  left: 18px;
  border-width: 0 0 4px 4px;
}

.scanner-placeholder-text p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
}



.scanner-placeholder-text.hidden {
  display: none;
}

.found-message {
  color: var(--success-text);
  font-weight: 600;
  margin: 0;
}

/* =========================
   STATUS MESSAGES
========================= */

.form-message,
.section-status {
  min-height: 24px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--pure-white);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  line-height: 1.45;
}

.form-message:empty {
  display: none;
}

.success {
  background: var(--success-bg) !important;
  color: var(--success-text) !important;
  border-color: rgba(40, 107, 53, 0.2) !important;
}

.error {
  background: var(--error-bg) !important;
  color: var(--error-text) !important;
  border-color: rgba(154, 37, 37, 0.22) !important;
}

/* =========================
   MANAGE PAGE
========================= */

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin-bottom: 16px;
}

.package-builder-card {
  margin-bottom: 22px;
}

.package-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.package-selection-summary {
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: #efeeec;
  color: var(--text-muted);
  white-space: nowrap;
}

.package-builder-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.package-builder-actions {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.client-placeholder-card {
  margin: 18px 0 22px;
}

.client-table-placeholder {
  margin-top: 18px;
  overflow-x: auto;
}

.client-row {
  min-width: 1220px;
  display: grid;
  grid-template-columns: 0.75fr 1.1fr 1fr 1.2fr 0.7fr 1.8fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.user-table-header,
.user-table-row {
  grid-template-columns: 1.5fr 1.2fr 1.5fr 1fr 0.9fr !important;
}

.header-row {
  font-weight: 800;
  background: #efeeec;
  border-radius: 10px;
}

.empty-row {
  color: var(--text-muted);
}

.client-list {
  display: grid;
}

.interactive-row {
  transition: background 0.15s ease, border-color 0.15s ease;
}

.interactive-row:hover {
  background: rgba(255, 255, 255, 0.6);
}

.selected-row {
  background: rgba(23, 23, 23, 0.06);
}

.checkbox-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.checkbox-cell input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.package-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.package-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #efeeec;
  color: var(--black);
  font-size: 0.86rem;
  line-height: 1.2;
}

.admin-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pending-qr-queue {
  display: grid;
  gap: 16px;
}

.pending-qr-empty {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.pending-qr-card {
  padding: 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--pure-white);
}

.pending-qr-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.pending-qr-header h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.pending-qr-header p,
.pending-qr-expiry {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.pending-qr-body {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 18px;
  align-items: center;
}

.pending-qr-preview {
  border-radius: 12px;
  background: var(--pure-white);
  padding: 12px;
  min-height: 160px;
  display: grid;
  place-items: center;
}

.pending-qr-preview svg {
  width: 100%;
  height: auto;
}

.pending-qr-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pending-qr-email-status {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.email-delivered {
  background: rgba(122, 213, 153, 0.18);
  color: #d6ffe3;
}

.email-missing {
  background: rgba(241, 163, 90, 0.18);
  color: #ffe2c4;
}

/* =========================
   HISTORY PAGE
========================= */

.history-empty-state {
  margin-top: 18px;
  padding: 22px;
  border: 1px dashed var(--border-soft);
  border-radius: 12px;
  background: var(--pure-white);
}

.history-empty-state p {
  margin: 8px 0 0;
}

/* =========================
   HISTORY PAGE
   ========================= */

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-card-header h3 {
  margin: 0;
}

.history-list {
  margin-top: 18px;
}

.history-table-placeholder {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-large);
  overflow: hidden;
}

.history-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr 1fr 1fr;
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.92rem;
}

.history-row:last-child {
  border-bottom: none;
}

.history-row.header-row {
  background: var(--warm-grey-light);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.history-action-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--card-white);
  color: var(--text-dark);
}

.history-action-user_created {
  background: var(--success-bg);
  color: var(--success-text);
}

.history-action-user_updated {
  background: #eef2ff;
  color: #3b5dc9;
}

.history-action-user_deleted {
  background: var(--error-bg);
  color: var(--error-text);
}

.history-action-package_assigned,
.history-action-package_created {
  background: #f0f9ff;
  color: #1e6bb8;
}

.history-action-session_added {
  background: var(--success-bg);
  color: var(--success-text);
}

.history-action-session_deducted {
  background: #fff8e6;
  color: #8a6d00;
}

/* =========================
    PACKAGE PAGES
   ========================= */

.package-table-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.package-list,
.member-list {
  display: grid;
}

.package-row {
  min-width: 620px;
  display: grid;
  grid-template-columns: 2fr 1fr 0.8fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.member-row {
  min-width: 820px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 0.8fr 0.8fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.pkg-name-cell {
  font-weight: 700;
}

/* Shared note cells across list tables (single-line preview; full text in title) */
.notes-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* Packages list gains a Notes column (admin-login list keeps its 3-column layout) */
body[data-page="packages"] .package-row {
  grid-template-columns: 2fr 0.8fr 1fr 0.8fr;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-active {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-exhausted {
  background: var(--error-bg);
  color: var(--error-text);
}

.package-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.card-label {
  margin: 0 0 4px;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-value {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.add-users-results {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: var(--pure-white);
}

.add-user-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.12s ease;
}

.add-user-result-item:last-child {
  border-bottom: 0;
}

.add-user-result-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.add-user-result-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  flex-shrink: 0;
}

.add-sessions-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.add-sessions-row input {
  min-height: 48px;
}

/* =========================
    MODAL
   ========================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.48);
  z-index: 50;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  width: min(460px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card-white);
  border-radius: 12px;
  padding: 34px;
  box-shadow: var(--shadow-card);
}

.large-modal {
  width: min(640px, 100%);
}

.modal-actions {
  margin-top: 18px;
}

/* =========================
   OPTIONAL FOOTER STYLE
   Only appears if your HTML has footer/simple-footer
========================= */

.simple-footer,
.checkin-footer {
  background: #dddddd;
  min-height: 150px;
  padding: 42px 9vw 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  color: var(--text-dark);
}

.simple-footer p,
.checkin-footer p {
  margin: 10px 0 0;
  color: #333333;
  line-height: 1.5;
}

/* =========================
   RESPONSIVE
========================= */

@media (orientation: portrait) {
  .checkin-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    height: calc(100vh - 70px);
  }

  .scanner-box {
    width: min(100%, 62vh);
  }
}

@media (max-width: 980px) {
  .top-bar,
  .checkin-header,
  .topbar {
    padding: 18px 32px;
  }

  .site-nav {
    display: none;
  }

  .dashboard-grid,
  .history-grid,
  .admin-action-grid {
    grid-template-columns: 1fr;
  }

  .admin-action-grid {
    gap: 18px;
  }
}

@media (max-width: 860px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .brand-panel,
  .brand-block {
    min-height: 250px;
    padding: 36px;
  }

  .login-card,
  .auth-card {
    margin: 34px 0;
  }

  .auth-split,
  .compact-actions {
    grid-template-columns: 1fr;
  }

  .auth-divider {
    padding-left: 0;
    border-left: 0;
    padding-top: 24px;
    border-top: 1px solid var(--border-soft);
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .package-builder-header,
  .pending-qr-header,
  .pending-qr-body {
    display: grid;
    grid-template-columns: 1fr;
  }

  .package-builder-grid {
    grid-template-columns: 1fr;
  }

  .top-bar,
  .checkin-header,
  .topbar {
    flex-wrap: wrap;
  }

  .header-actions,
  .topbar-actions {
    width: 100%;
  }

  .header-actions .secondary-button,
  .topbar-actions .secondary-button,
  .topbar-actions .btn,
  .checkin-header .secondary-button {
    flex: 1;
  }
}

@media (max-width: 640px) {
  .top-bar,
  .checkin-header,
  .topbar {
    padding: 16px 20px;
  }

  .top-bar h1,
  .checkin-header h1,
  .topbar h1,
  .spaced {
    font-size: 1.25rem;
  }

  .page-section,
  .content-section {
    width: min(100% - 28px, 1180px);
    padding: 36px 0 56px;
  }

  .page-title h2,
  .section-heading h1 {
    font-size: 2.4rem;
  }

  .dashboard-card,
  .small-card,
  .history-card,
  .client-placeholder-card {
    padding: 24px;
  }

  .client-row,
  .user-table-header,
  .user-table-row {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .package-row,
  .member-row {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .package-detail-grid {
    grid-template-columns: 1fr;
  }

  .checkin-layout {
    padding: 10px 10px;
    gap: 10px;
  }

  .checkin-panel {
    padding: 12px;
  }

  .keypad {
    gap: 6px;
  }

  .keypad button {
    min-height: 42px;
  }

  .scanner-box {
    min-height: 0;
  }

  .simple-footer,
  .checkin-footer {
    grid-template-columns: 1fr;
    padding: 32px 24px;
  }

  /* Packages list: collapse to a single column on small screens */
  body[data-page="packages"] .package-row {
    grid-template-columns: 1fr;
  }
}

/* =========================
   QR MODAL STYLES
   ========================= */

.qr-modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 16px 0;
}

.qr-code-item {
  background: var(--card-white);
  border-radius: var(--radius-large);
  padding: 20px;
  border: 1px solid var(--border-soft);
}

.qr-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

.package-type-badge {
  font-weight: 600;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qr-code-svg-container svg {
  display: block;
  max-width: 140px;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.qr-code-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.pending-qr-svg svg {
  display: block;
  max-width: 120px;
  height: auto;
  margin: 8px auto;
}

.user-table-header {
  grid-template-columns: 1.5fr 1.2fr 1.5fr 1fr 0.9fr !important;
}

.package-type-badge {
  background: var(--card-white);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-soft);
}
