* {
  box-sizing: border-box;
}

:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18302b;
  background: #f3f6f4;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
  padding: 32px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(80, 173, 144, .18), transparent 34%),
    #f3f6f4;
}

.auth-shell,
.pin-shell {
  width: min(100%, 440px);
  background: #fff;
  padding: 42px;
  border-radius: 30px;
  box-shadow: 0 24px 70px rgba(16, 53, 45, .12);
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #143f36;
  color: white;
  font-size: 27px;
  font-weight: 900;
  margin-bottom: 26px;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  margin: 0;
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #73827d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}

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

.auth-shell h1,
.pin-shell h1 {
  margin-bottom: 10px;
  font-size: 34px;
  letter-spacing: -1.5px;
}

.lead,
.pin-copy {
  color: #6f7d78;
  line-height: 1.6;
}

.auth-form {
  margin-top: 30px;
}

label {
  display: block;
  color: #56645f;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #dbe3df;
  border-radius: 14px;
  padding: 14px 15px;
  outline: none;
  background: #fff;
  color: #18302b;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #428875;
  box-shadow: 0 0 0 3px rgba(66, 136, 117, .12);
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 800;
}

.btn.primary {
  width: 100%;
  margin-top: 18px;
  background: #143f36;
  color: #fff;
}

.btn.secondary {
  background: #fff;
  color: #214c42;
  border: 1px solid #d8e2de;
}

.small-note {
  margin: 20px 0 0;
  color: #8a9692;
  font-size: 11px;
}

.staff-login-shell {
  width: min(1100px, 100%);
}

.login-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 30px;
}

.login-header h1 {
  margin-bottom: 5px;
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: -2px;
}

.login-header p {
  color: #72807b;
}

.ghost-btn,
.back-btn {
  border: 0;
  background: transparent;
  color: #527068;
  font-weight: 800;
}

.staff-profiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}

.staff-profile-card {
  border: 1px solid #e0e7e4;
  background: #fff;
  border-radius: 24px;
  padding: 22px;
  text-align: left;
  box-shadow: 0 12px 38px rgba(24, 61, 52, .06);
  transition: .18s ease;
}

.staff-profile-card:hover {
  transform: translateY(-3px);
  border-color: #a9c8bd;
}

.staff-profile-photo,
.selected-avatar,
.chip-avatar {
  overflow: hidden;
  background: #deebe6;
  display: grid;
  place-items: center;
  color: #17463c;
  font-weight: 900;
}

.staff-profile-photo {
  width: 72px;
  height: 72px;
  border-radius: 21px;
  margin-bottom: 20px;
  font-size: 20px;
}

.staff-profile-photo img,
.selected-avatar img,
.chip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-profile-card strong {
  display: block;
  font-size: 16px;
}

.staff-profile-card small {
  display: block;
  color: #83908c;
  margin-top: 5px;
}

.pin-shell {
  text-align: center;
}

.back-btn {
  display: block;
  margin-bottom: 22px;
}

.selected-avatar {
  width: 88px;
  height: 88px;
  border-radius: 26px;
  margin: 0 auto 24px;
  font-size: 24px;
}

.pin-dots {
  height: 26px;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}

.pin-dots span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #adc0b9;
}

.pin-dots span.filled {
  background: #173f36;
  border-color: #173f36;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

.pin-pad button {
  min-height: 62px;
  border: 1px solid #dce5e1;
  border-radius: 16px;
  background: #f8faf9;
  color: #1b443b;
  font-size: 20px;
  font-weight: 800;
}

.pin-pad button[data-pin-clear] {
  font-size: 11px;
}

.pin-pad .pin-enter {
  background: #153f36;
  color: white;
}

.error-text {
  min-height: 20px;
  margin-top: 16px;
  color: #a8473e;
  font-size: 12px;
}

.pos {
  min-height: 100vh;
}

.pos-header {
  height: 76px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #e4e9e7;
}

.pos-brand,
.staff-chip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pos-brand small,
.staff-chip small {
  display: block;
  color: #82908b;
  margin-top: 2px;
}

.chip-avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.staff-chip button {
  margin-left: 8px;
  border: 0;
  background: #f1f5f3;
  border-radius: 10px;
  padding: 9px 11px;
  color: #5e6f69;
  font-size: 11px;
  font-weight: 800;
}

.pos-body {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
}

.catalogue {
  padding: 30px;
}

.catalogue-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.catalogue-top h1 {
  margin-bottom: 0;
  font-size: 32px;
  letter-spacing: -1.4px;
}

.customer-tools {
  display: flex;
  gap: 9px;
}

.customer-banner {
  margin: 24px 0;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 17px;
  background: #eaf3ef;
  border: 1px solid #d5e5de;
}

.customer-banner.empty {
  background: #fff;
}

.customer-banner small {
  display: block;
  color: #778680;
  margin-top: 3px;
}

.customer-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #d9ebe4;
}

.service-search {
  max-width: 480px;
  margin-bottom: 20px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}

.service-card {
  min-height: 150px;
  border: 1px solid #e0e7e4;
  border-radius: 20px;
  background: #fff;
  padding: 19px;
  text-align: left;
  box-shadow: 0 8px 28px rgba(19, 54, 46, .045);
}

.service-card:hover {
  border-color: #9fc2b6;
}

.service-card span {
  display: block;
  color: #83908c;
  font-size: 11px;
  margin-bottom: 20px;
}

.service-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 8px;
}

.service-card b {
  color: #1e6a56;
  font-size: 18px;
}

.loading-card {
  color: #7c8985;
}

.basket {
  padding: 26px;
  background: #fff;
  border-left: 1px solid #e2e8e5;
  display: flex;
  flex-direction: column;
}

.basket-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.basket-head h2 {
  font-size: 26px;
  margin-bottom: 0;
}

.text-btn {
  border: 0;
  background: transparent;
  color: #698079;
  font-weight: 800;
}

.basket-items {
  flex: 1;
  margin: 22px 0;
  overflow: auto;
}

.empty-basket {
  padding: 50px 15px;
  text-align: center;
  color: #85918d;
}

.empty-basket span {
  width: 48px;
  height: 48px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #f0f5f3;
  font-size: 20px;
}

.empty-basket strong {
  display: block;
  color: #5e6d68;
}

.empty-basket p {
  font-size: 11px;
  margin-top: 6px;
}

.basket-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid #edf0ef;
}

.basket-line small {
  display: block;
  color: #84908c;
  margin-top: 4px;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-control button {
  width: 29px;
  height: 29px;
  border: 1px solid #dce4e1;
  background: #fff;
  border-radius: 9px;
  font-weight: 900;
}

.checkout-options {
  display: grid;
  gap: 12px;
}

.checkout-options textarea {
  resize: vertical;
  min-height: 70px;
}

.basket-total {
  margin: 20px 0 14px;
  padding-top: 17px;
  border-top: 1px solid #e4e9e7;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.basket-total strong {
  font-size: 24px;
}

.checkout-btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 15px;
  background: #143f36;
  color: #fff;
  font-weight: 900;
}

.checkout-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 20px;
  background: rgba(10, 27, 23, .48);
  display: grid;
  place-items: center;
}

.modal-card {
  width: min(500px, 100%);
  max-height: 90vh;
  overflow: auto;
  position: relative;
  background: #fff;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .18);
}

.modal-close {
  position: absolute;
  right: 16px;
  top: 14px;
  border: 0;
  background: transparent;
  font-size: 24px;
}

@media (max-width: 950px) {
  .pos-body {
    grid-template-columns: 1fr;
  }

  .basket {
    border-left: 0;
    border-top: 1px solid #e2e8e5;
  }
}

@media (max-width: 650px) {
  .screen,
  .catalogue,
  .basket {
    padding: 18px;
  }

  .auth-shell,
  .pin-shell {
    padding: 28px 20px;
  }

  .pos-header {
    height: auto;
    padding: 14px 16px;
  }

  .pos-brand small,
  .staff-chip small {
    display: none;
  }

  .catalogue-top,
  .login-header {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

/* Universal customer QR scanner */
.customer-qr-scanner {
  width: 100%;
}

.scanner-intro {
  margin: 6px 0 18px;
  color: #6f7f79;
  line-height: 1.55;
}

.qr-camera-frame {
  position: relative;
  width: 100%;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid #dce7e2;
  border-radius: 22px;
  background: #101816;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}

#customerQrReader {
  width: 100%;
  min-height: 280px;
}

#customerQrReader video,
#customerQrReader img {
  display: block;
  width: 100% !important;
  min-height: 280px;
  object-fit: cover;
}

#customerQrReader__scan_region {
  min-height: 280px;
}

#customerQrReader__dashboard {
  padding: 10px !important;
  background: #fff;
}

.qr-scan-overlay {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: min(230px, 68%);
  aspect-ratio: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 24px;
  box-shadow:
    0 0 0 999px rgba(4,18,14,.24),
    0 0 28px rgba(255,255,255,.12);
}

.qr-scan-overlay::before,
.qr-scan-overlay::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  height: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 14px rgba(255,255,255,.9);
}

.qr-scan-overlay::before {
  top: 34%;
}

.qr-scan-overlay::after {
  bottom: 34%;
}

.scanner-status {
  margin: 14px 0;
  padding: 11px 13px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  border: 1px solid #dce6e2;
  background: #f4f7f6;
  color: #62716c;
}

.scanner-status.scanning {
  background: #f6f8f7;
  color: #53645e;
}

.scanner-status.ready {
  border-color: #cde5da;
  background: #edf8f3;
  color: #176443;
}

.scanner-status.success {
  border-color: #b9dfce;
  background: #e5f7ef;
  color: #0d6842;
}

.scanner-status.error {
  border-color: #f0cccc;
  background: #fff2f2;
  color: #a33131;
}

.scanner-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: end;
  margin-top: 12px;
}

.scanner-camera-field {
  display: grid;
  gap: 6px;
  margin: 0;
}

.scanner-camera-field span {
  font-size: 11px;
  font-weight: 800;
  color: #73827d;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.scanner-camera-field select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d8e2de;
  border-radius: 12px;
  background: #fff;
  color: #17241f;
}

.scanner-controls button {
  min-height: 42px;
  white-space: nowrap;
}

.scanner-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 16px;
}

.scanner-methods > div {
  padding: 12px;
  border: 1px solid #e0e8e4;
  border-radius: 14px;
  background: #f8faf9;
}

.scanner-methods strong,
.scanner-methods span {
  display: block;
}

.scanner-methods strong {
  margin-bottom: 4px;
  color: #18352b;
  font-size: 12px;
}

.scanner-methods span {
  color: #71807b;
  font-size: 10px;
  line-height: 1.4;
}

@media (max-width: 650px) {
  .qr-camera-frame,
  #customerQrReader,
  #customerQrReader video,
  #customerQrReader img,
  #customerQrReader__scan_region {
    min-height: 240px;
  }

  .scanner-controls {
    grid-template-columns: 1fr 1fr;
  }

  .scanner-camera-field {
    grid-column: 1 / -1;
  }

  .scanner-methods {
    grid-template-columns: 1fr;
  }

  .qr-scan-overlay {
    width: min(210px, 72%);
  }
}

/* Staff customer creation */
.staff-customer-form > p:not(.eyebrow) {
  margin: 6px 0 20px;
  color: #6f7d78;
  line-height: 1.55;
}

.staff-customer-form label {
  margin-top: 15px;
}

.staff-customer-form label small {
  color: #89958f;
  font-weight: 600;
}

.customer-form-status {
  min-height: 18px;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.customer-form-status.error {
  padding: 10px 12px;
  border: 1px solid #f0cccc;
  border-radius: 12px;
  background: #fff2f2;
  color: #a33131;
}

.customer-form-status.success {
  padding: 10px 12px;
  border: 1px solid #b9dfce;
  border-radius: 12px;
  background: #e5f7ef;
  color: #0d6842;
}

.customer-save-btn {
  width: 100%;
  margin-top: 14px;
}

.customer-save-btn:disabled {
  opacity: .55;
  cursor: wait;
}

@media (max-width: 1100px) {
  .customer-tools {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }
}

@media (max-width: 650px) {
  .customer-tools {
    grid-template-columns: 1fr;
  }

  .customer-tools .btn {
    width: 100%;
  }
}
