:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-strong: #eef3f1;
  --text: #18211f;
  --muted: #66716e;
  --line: #d9e1de;
  --accent: #166b5b;
  --accent-strong: #0f4f43;
  --warning: #a45614;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 26px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 720;
}

h2 {
  font-size: 20px;
  font-weight: 700;
}

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

.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 28px;
  align-items: start;
  padding-top: 54px;
}

.login-copy {
  max-width: 620px;
  display: grid;
  gap: 12px;
}

.login-copy h2 {
  font-size: 42px;
  line-height: 1.08;
}

.login-copy p:last-child {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.login-panel,
.form-grid,
.admin-auth-fields {
  display: grid;
  gap: 16px;
}

.panel-heading {
  display: grid;
  gap: 5px;
}

.row-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}

label,
.field-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 107, 91, 0.12);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.segment {
  min-height: 40px;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  font-weight: 720;
}

.segment + .segment {
  border-left: 1px solid var(--line);
}

.segment.is-active {
  background: var(--accent);
  color: #ffffff;
}

.primary-action,
.ghost-action,
.danger-action,
.small-action {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 9px 13px;
  font-weight: 720;
}

.primary-action {
  background: var(--accent);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.ghost-action,
.small-action {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--text);
}

.danger-action {
  background: #fff5f3;
  border-color: #ffd1ca;
  color: var(--danger);
}

.session-panel {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.workspace {
  display: grid;
  gap: 18px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 12px 8px 10px;
  font-weight: 760;
}

.tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.grid {
  display: grid;
  gap: 18px;
}

.two-columns {
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
}

.form-grid {
  grid-template-columns: 1fr 1fr;
  align-content: start;
}

.form-grid .panel-heading,
.full-width {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface-strong);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.badge.warning {
  background: #fff4e8;
  color: var(--warning);
}

.badge.danger {
  background: #fff0ee;
  color: var(--danger);
}

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

.booking-item {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfc;
}

.guest-card {
  gap: 16px;
}

.booking-item-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

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

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

.guest-status > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 10px;
}

.guest-status span,
.backup-code span,
.backup-code small,
.qr-details p {
  color: var(--muted);
}

.guest-status span {
  font-size: 12px;
  font-weight: 750;
}

.guest-status strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.booking-number {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.meta-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.meta-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meta-cell strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-actions {
  align-items: flex-start;
}

.compact-actions .primary-action,
.compact-actions .ghost-action,
.compact-actions .danger-action,
.compact-actions .small-action {
  min-height: 34px;
  padding: 7px 10px;
}

.inline-action {
  min-height: 28px;
  margin: 0 0 4px 8px;
  padding: 4px 8px;
  font-size: 12px;
}

.inline-date-editor {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.inline-date-editor label {
  gap: 4px;
  font-size: 12px;
}

.inline-date-editor input {
  padding: 8px 9px;
}

.token-output {
  display: none;
  margin: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101615;
  color: #e6fff8;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

.token-output.has-content {
  display: block;
}

.qr-panel,
.backup-panel {
  display: grid;
  gap: 12px;
}

.qr-card {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.qr-image {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.qr-image svg {
  display: block;
  width: min(100%, 230px);
  height: auto;
}

.qr-details {
  display: grid;
  gap: 9px;
  align-content: center;
}

.qr-details h3,
.backup-heading h3 {
  margin: 0;
  font-size: 18px;
}

.qr-details .small-action {
  width: fit-content;
}

.backup-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.backup-note {
  color: var(--warning);
  font-size: 14px;
  line-height: 1.45;
}

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

.backup-single {
  display: grid;
  gap: 12px;
}

.backup-code {
  display: grid;
  gap: 8px;
  min-height: 224px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 10px;
}

.backup-code-qr {
  display: grid;
  place-items: center;
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.backup-code-qr svg {
  display: block;
  width: min(100%, 132px);
  height: auto;
}

.backup-code-qr.is-missing {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.backup-code strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.backup-code span,
.backup-code small {
  font-size: 12px;
  font-weight: 700;
}

.backup-code.is-used {
  background: #f5f7f8;
}

.backup-stepper,
.backup-jump-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.backup-stepper {
  justify-content: space-between;
}

.backup-jump {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.backup-jump.is-selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.message {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--accent-strong);
}

.is-hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .topbar,
  .login-view,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .session-panel {
    justify-content: flex-start;
  }

  .login-view {
    padding-top: 20px;
  }

  .login-copy h2 {
    font-size: 32px;
  }

  .form-grid,
  .meta-grid,
  .guest-status,
  .qr-card {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 12px;
  }

  h1 {
    font-size: 23px;
  }

  .panel {
    padding: 15px;
  }

  .row-heading,
  .booking-item-header {
    display: grid;
  }
}
