:root {
  --bg: #f9f4ed;
  --paper: #fffdf8;
  --panel: #ffffff;
  --ink: #000000;
  --brown: #352821;
  --muted: #776b5f;
  --line: #f2eadf;
  --line-strong: #c2b191;
  --accent: #a69679;
  --accent-dark: #806f55;
  --accent-2: #ad4128;
  --accent-3: #c05530;
  --warning: #9a6b00;
  --danger: #b20000;
  --shadow: 8px 8px 0 rgba(166, 150, 121, .38);
  --soft-shadow: 0 18px 45px rgba(53, 40, 33, .08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(249, 244, 237, .94)),
    var(--bg);
  font-family: "Noto Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

.auth-screen[hidden],
.app-shell[hidden] {
  display: none;
}

.auth-card {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  background: rgba(255, 253, 248, .96);
  box-shadow: var(--soft-shadow);
}

.auth-brand {
  padding: 0 0 18px;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  min-height: 58px;
  padding: 6px 10px;
  overflow: hidden;
  color: var(--ink);
  background: rgba(255, 253, 248, .94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(53, 40, 33, .06);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 0;
}

.brand-logo {
  width: 72px;
  max-height: 30px;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand b {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  line-height: 1.15;
}

.brand small,
.account-meta small,
.account-meta span {
  color: var(--muted);
}

.brand small {
  font-size: 11px;
}

.side-nav {
  display: grid;
  grid-template-columns: 106px 136px 166px 148px 104px 96px;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  gap: 5px;
  min-width: 0;
}

.nav-item,
.ghost-button,
.primary-button,
.secondary-button,
.danger-button {
  border: 0;
  border-radius: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 34px;
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  color: var(--brown);
  background: transparent;
  text-align: center;
  white-space: nowrap;
}

.nav-item b {
  display: block;
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.12;
}

.nav-item span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 7px;
  background: #f4ece1;
  font-size: 12px;
  font-weight: 800;
}

.nav-item.is-active {
  color: #fff;
  background: var(--accent-2);
}

.nav-item.is-active span {
  background: rgba(255, 255, 255, .16);
}

.ghost-button {
  display: block;
  width: auto;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--brown);
  background: #f0ebe0;
  text-align: center;
  text-decoration: none;
  font-weight: 800;
}

.main {
  min-width: 0;
  padding: 12px 18px 18px;
  margin-top: 0;
}

.topbar {
  margin-bottom: 10px;
}

.app-shell[data-active-view="customerDetail"] .main,
.app-shell[data-active-view="checkout"] .main {
  padding-top: 10px;
}

.app-shell[data-active-view="customerDetail"] .topbar,
.app-shell[data-active-view="checkout"] .topbar {
  margin: 0 0 12px;
}

.app-shell[data-active-view="customerDetail"] .view.is-active,
.app-shell[data-active-view="checkout"] .view.is-active {
  margin-top: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.account-card,
.panel,
.metric-card,
.modal {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}

.account-card {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  height: 40px;
  gap: 6px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.account-meta {
  display: grid;
  gap: 1px;
  width: 118px;
  overflow: hidden;
}

.account-meta span,
.account-meta small {
  font-size: 11px;
}

.account-meta b {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.account-actions .ghost-button,
.account-actions .secondary-button {
  min-height: 32px;
  padding: 7px 8px;
  white-space: nowrap;
  font-size: 13px;
}

.account-meta span,
.metric-card span,
.empty-state,
.single-row span,
.price-card span,
.compact-item span,
.notice-box span {
  color: var(--muted);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 18px;
}

.metric-card b {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.users-grid {
  align-items: start;
}

.user-create-panel {
  align-self: start;
}

.user-list-panel {
  min-height: 0;
}

.grid-span {
  grid-column: 1 / -1;
}

.admin-profile-grid {
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
}

.panel {
  min-width: 0;
  padding: 20px;
}

.panel-head,
.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.form-panel {
  align-self: start;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.combo-form-grid {
  grid-template-columns: 1.4fr repeat(4, minmax(130px, .8fr)) auto;
  align-items: end;
}

.combo-form-actions {
  align-items: end;
}

.combo-table-wrap {
  margin-top: 18px;
}

.user-table-wrap table {
  min-width: 760px;
}

.grid-wide {
  grid-column: 1 / -1;
}

.create-profile-panel {
  max-width: 1080px;
}

.warning-panel {
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 7px;
}

[data-staff-field][hidden] {
  display: none !important;
}

label span {
  color: #4a4139;
  font-size: 13px;
  font-weight: 800;
}

.field-hint {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.field-hint.is-error {
  color: #b71c15;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  font-weight: 900;
  text-align: left;
}

.link-button:hover {
  color: var(--accent-2);
}

.reset-password-form {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.reset-password-form[hidden] {
  display: none;
}

.reset-password-step {
  display: grid;
  gap: 12px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.reset-password-step[hidden] {
  display: none;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.checkbox-line span {
  color: var(--brown);
  font-size: 14px;
}

[data-user-otp-block][hidden] {
  display: none;
}

.otp-setup {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fffaf2;
}

.otp-setup[hidden] {
  display: none;
}

.otp-qr-frame {
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.otp-qr-frame img {
  width: 116px;
  height: 116px;
}

.otp-setup-copy {
  display: grid;
  gap: 10px;
}

.customer-match-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.customer-match-list[hidden] {
  display: none;
}

.customer-match-card {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  color: var(--brown);
  background: #fff;
  text-align: left;
}

.customer-match-card b,
.customer-match-card span {
  display: block;
}

.customer-match-card span {
  color: var(--muted);
  font-size: 12px;
}

.customer-match-card:hover {
  border-color: var(--accent);
  background: #fffdf8;
}

.customer-detail-result {
  margin-top: 18px;
}

.customer-detail-form {
  margin-bottom: 18px;
}

.audit-section {
  margin-top: 22px;
}

.detail-combo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.detail-combo-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px;
  background: #fff;
}

.detail-combo-card b,
.detail-combo-card span,
.detail-combo-card strong {
  display: block;
}

.detail-combo-card span {
  color: var(--muted);
  font-size: 13px;
}

.detail-combo-card strong {
  color: var(--accent-dark);
}

.detail-combo-card.is-warning {
  border-color: #d8b33f;
  background: #fff8d6;
}

.detail-combo-card.is-disabled {
  opacity: .72;
  border-color: rgba(178, 0, 0, .28);
  background: #fff0ee;
}

.detail-combo-card.is-disabled strong {
  color: var(--danger);
}

.checkout-result {
  margin-top: 18px;
}

.checkout-session-list {
  display: grid;
  gap: 14px;
}

.checkout-session-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 16px;
  background: #fff;
}

.checkout-session-card.is-late {
  border-color: rgba(178, 0, 0, .45);
  background: #fff4f1;
}

.checkout-session-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.checkout-session-head h3 {
  margin: 0 0 5px;
  font-size: 24px;
}

.checkout-session-head span,
.checkout-summary span {
  color: var(--muted);
}

.checkout-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--accent-dark);
  background: rgba(166, 150, 121, .18);
  font-size: 13px;
}

.checkout-status.is-late {
  color: var(--danger);
  background: rgba(179, 38, 30, .12);
}

.checkout-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.checkout-summary div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fffdf8;
}

.checkout-summary span,
.checkout-summary b {
  display: block;
}

.checkout-summary b {
  margin-top: 4px;
  font-size: 16px;
}

.checkout-warning {
  margin: 0;
  border-radius: 12px;
  padding: 12px;
  color: var(--danger);
  background: rgba(179, 38, 30, .1);
  font-weight: 800;
  line-height: 1.45;
}

input,
select,
textarea {
  width: 100%;
  border: 1.5px solid #e0ddd5;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--accent-dark);
  background: #faf9f7;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(166, 150, 121, .16);
}

input[readonly] {
  color: #6f655b;
  background: #eee7dd;
}

.password-field {
  position: relative;
  display: grid;
}

.password-field input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  padding: 0;
  color: var(--brown);
  background: #f0ebe0;
  transform: translateY(-50%);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.password-toggle:hover {
  background: #e5dccf;
}

.button-row,
.inline-form {
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 10px 13px;
  font-weight: 900;
}

.primary-button:hover,
.danger-button:hover {
  filter: brightness(.96);
}

.ghost-button:hover,
.secondary-button:hover {
  background: #e5dccf;
}

.primary-button {
  color: #fff;
  background: var(--accent-2);
}

.primary-button:disabled {
  cursor: not-allowed;
  color: #8c847b;
  background: #ded8cf;
}

.secondary-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: .45;
  filter: grayscale(1);
}

.secondary-button {
  color: var(--brown);
  background: #f0ebe0;
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(166, 150, 121, .18);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.state-badge.warning {
  color: var(--warning);
  background: rgba(217, 164, 65, .18);
}

.state-badge.danger {
  color: var(--danger);
  background: rgba(179, 38, 30, .12);
}

.notice-box,
.empty-state {
  margin: 14px 0 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
}

.compact-list {
  display: grid;
  gap: 10px;
}

.compact-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  background: #fff;
}

.search-input {
  width: min(320px, 100%);
}

.table-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.date-menu {
  position: relative;
  flex: 0 0 auto;
}

.date-menu-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--brown);
  background: #fff;
  font-weight: 900;
  white-space: nowrap;
}

.date-menu-button.is-active {
  border-color: rgba(174, 74, 50, .45);
  color: var(--accent-2);
  background: #fff6f1;
}

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

.date-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: 230px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(53, 40, 33, .16);
}

.date-popover label {
  display: grid;
  gap: 5px;
}

.date-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.date-quick-grid button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--brown);
  background: #f8f3ea;
  font-weight: 800;
  text-align: center;
}

.date-popover span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.date-popover input {
  min-height: 38px;
  padding: 8px 9px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination:empty {
  display: none;
}

.pagination-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination button {
  min-width: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  color: var(--brown);
  background: #f4eee5;
  font-weight: 900;
}

.pagination button.is-active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid #eee6dc;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #4b423a;
  background: #f9f4ed;
  font-size: 12px;
  text-transform: uppercase;
}

.action-cell {
  display: flex;
  gap: 8px;
}

.used-count-button {
  min-width: 42px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  background: #f1ece3;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.used-count-button:hover {
  background: #e6ddcf;
}

.used-count-button:focus-visible {
  outline: 3px solid rgba(166, 76, 49, .28);
  outline-offset: 2px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.price-card,
.single-row,
.logic-grid div {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.price-card {
  display: grid;
  gap: 9px;
  padding: 15px;
}

.price-card h3 {
  margin: 0;
  font-size: 18px;
}

.price-card strong,
.single-row b {
  color: var(--accent-2);
}

.price-card strong {
  font-size: 24px;
}

.single-list {
  display: grid;
  gap: 10px;
}

.single-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 14px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--line);
}

.tag button {
  border: 0;
  color: var(--danger);
  background: transparent;
  font-weight: 900;
}

.logic-panel {
  margin-top: 18px;
}

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

.logic-grid div {
  display: grid;
  gap: 8px;
  padding: 14px;
}

code {
  overflow-wrap: anywhere;
  color: #4b423a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.warning-cell {
  background: #fff4b8;
}

tr.is-checkout-soon td {
  background: #fff4b8;
}

tr.is-checkout-soon td:first-child {
  box-shadow: inset 4px 0 0 #d8a400;
}

.danger-cell {
  color: #fff;
  background: var(--danger);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 13px 15px;
  color: #fff;
  background: #211c18;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.checkin-page {
  background:
    linear-gradient(180deg, rgba(249, 244, 237, .86), rgba(249, 244, 237, .97)),
    url("../assets/gach-brand/gach-space-hero.jpg") center / cover fixed,
    var(--bg);
}

.checkin-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.checkin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, .54);
  border-radius: 15px;
  padding: 16px 18px;
  color: var(--ink);
  background: rgba(255, 253, 248, .9);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(12px);
}

.checkin-hero .brand {
  padding: 0;
}

.checkin-hero .brand-logo {
  width: 132px;
}

.checkin-time {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #f9f4ed;
}

.checkin-time span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.checkin-time b {
  display: block;
  margin-top: 4px;
}

.checkin-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.checkin-card h1 {
  margin-bottom: 10px;
  font-weight: 700;
}

.checkin-copy {
  color: var(--muted);
  line-height: 1.55;
}

.checkin-combo-list {
  display: grid;
  gap: 10px;
}

.checkin-combo-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px;
  background: #fff;
}

.checkin-combo-option.is-disabled {
  opacity: .55;
  background: #f4f0ea;
}

.checkin-combo-option.is-warning {
  border-color: #d8b33f;
  background: #fff8d6;
}

.checkin-combo-option.is-danger {
  border-color: #b3261e;
  background: #fff0ee;
}

.checkin-combo-option input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.checkin-combo-option b,
.checkin-combo-option small,
.checkin-combo-option em {
  display: block;
}

.checkin-combo-option small {
  margin-top: 3px;
  color: var(--muted);
}

.checkin-combo-option em {
  margin-top: 9px;
  font-style: normal;
}

.success-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.success-summary div {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px;
  background: #fff;
}

.success-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.success-summary b {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.modal {
  width: min(560px, calc(100% - 28px));
  padding: 22px;
}

.modal::backdrop {
  background: rgba(20, 16, 12, .38);
}

@media (max-width: 1100px) {
  .sidebar {
    position: sticky;
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    gap: 10px;
    padding: 12px;
    overflow: visible;
  }

  .brand {
    justify-content: flex-start;
  }

  .side-nav {
    display: flex;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    justify-content: center;
    padding: 8px 10px;
  }

  .nav-item b {
    display: block;
    font-size: 12px;
  }

  .main {
    padding: 10px 18px 18px;
    margin-top: 0;
  }

  .account-card,
  .account-actions,
  .content-grid,
  .checkin-layout,
  .metric-grid,
  .logic-grid,
  .profile-form-grid,
  .combo-form-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .account-card {
    height: auto;
    gap: 8px;
  }

  .account-meta {
    width: auto;
  }

  .checkin-hero {
    display: grid;
  }
}

@media (max-width: 560px) {
  .main {
    padding: 10px 14px 14px;
    margin-top: 0;
  }

  .panel {
    padding: 15px;
  }

  .side-nav {
    gap: 5px;
  }

  .button-row,
  .inline-form,
  .success-summary,
  .checkout-summary,
  .checkout-session-head {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Final layout guard: lookup-only admin views must start directly under the menu. */
.app-shell[data-active-view="customerDetail"],
.app-shell[data-active-view="checkout"] {
  align-content: start !important;
  grid-auto-rows: max-content !important;
}

.app-shell[data-active-view="customerDetail"] > .main,
.app-shell[data-active-view="checkout"] > .main {
  display: block !important;
  align-self: start !important;
  min-height: 0 !important;
  height: auto !important;
  padding-top: 8px !important;
  margin-top: 0 !important;
  position: relative !important;
  top: 0 !important;
  transform: none !important;
}

.app-shell[data-active-view="customerDetail"] > .main > .topbar,
.app-shell[data-active-view="checkout"] > .main > .topbar {
  display: block !important;
  position: static !important;
  margin: 0 0 8px !important;
  padding: 0 !important;
  min-height: 0 !important;
  top: auto !important;
  transform: none !important;
}

.app-shell[data-active-view="customerDetail"] > .main > .topbar .eyebrow,
.app-shell[data-active-view="checkout"] > .main > .topbar .eyebrow,
.app-shell[data-active-view="customerDetail"] > .main > .topbar h1,
.app-shell[data-active-view="checkout"] > .main > .topbar h1 {
  margin-top: 0 !important;
}

.app-shell[data-active-view="customerDetail"] > .main > .view.is-active,
.app-shell[data-active-view="checkout"] > .main > .view.is-active {
  margin-top: 0 !important;
  padding-top: 0 !important;
  position: static !important;
  top: auto !important;
  transform: none !important;
}

/* Keep the profile table stable across pagination pages. */
.profile-table {
  table-layout: fixed;
  width: 100%;
  min-width: 1280px;
}

.profile-table .profile-col-stt { width: 42px; }
.profile-table .profile-col-staff { width: 76px; }
.profile-table .profile-col-branch { width: 34px; }
.profile-table .profile-col-customer { width: 132px; }
.profile-table .profile-col-note { width: 72px; }
.profile-table .profile-col-phone { width: 96px; }
.profile-table .profile-col-combo { width: 82px; }
.profile-table .profile-col-purchase { width: 78px; }
.profile-table .profile-col-start { width: 82px; }
.profile-table .profile-col-expiry { width: 78px; }
.profile-table .profile-col-hours { width: 52px; }
.profile-table .profile-col-status { width: 78px; }
.profile-table .profile-col-allowed { width: 58px; }
.profile-table .profile-col-used { width: 58px; }
.profile-table .profile-col-left { width: 56px; }
.profile-table .profile-col-validity { width: 78px; }
.profile-table .profile-col-actions { width: 92px; }

.profile-table th,
.profile-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.profile-table th:nth-child(1),
.profile-table td:nth-child(1),
.profile-table th:nth-child(3),
.profile-table td:nth-child(3),
.profile-table th:nth-child(11),
.profile-table td:nth-child(11),
.profile-table th:nth-child(13),
.profile-table td:nth-child(13),
.profile-table th:nth-child(14),
.profile-table td:nth-child(14),
.profile-table th:nth-child(15),
.profile-table td:nth-child(15) {
  text-align: center;
}
