/* 申勤访客通 H5 — mobile-first 蓝白登录 + 预约布局钩子 */

:root {
  --sq-blue: #1a6fd4;
  --sq-blue-deep: #0f4fa8;
  --sq-blue-soft: #e8f1fc;
  --sq-sky: #5ba3e8;
  --sq-bg: #f0f5fb;
  --sq-card: #ffffff;
  --sq-text: #1a2332;
  --sq-muted: #6b7a90;
  --sq-border: #d4e0ef;
  --sq-danger: #d14343;
  --sq-radius: 12px;
  --sq-shadow: 0 8px 28px rgba(15, 79, 168, 0.12);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--sq-text);
  background: var(--sq-bg);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
}

.view[hidden] {
  display: none !important;
}

/* —— Toast —— */
.toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  z-index: 1000;
  max-width: min(92vw, 360px);
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(26, 35, 50, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.toast[hidden] {
  display: none !important;
}

/* —— Login —— */
.view-login {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, #7eb6f0 0%, transparent 55%),
    linear-gradient(165deg, #1a6fd4 0%, #0f4fa8 42%, #e8f1fc 42%, #f0f5fb 100%);
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  padding: 28px 22px 22px;
  background: var(--sq-card);
  border-radius: var(--sq-radius);
  box-shadow: var(--sq-shadow);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, var(--sq-sky), var(--sq-blue-deep));
  box-shadow: 0 4px 12px rgba(26, 111, 212, 0.35);
}

.login-brand {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--sq-blue-deep);
}

.login-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--sq-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  color: var(--sq-muted);
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--sq-border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--sq-text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  border-color: var(--sq-blue);
  box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.15);
}

.field input::placeholder {
  color: #a8b4c4;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

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

.btn-primary {
  background: var(--sq-blue);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--sq-blue-deep);
}

.btn-block {
  width: 100%;
  margin-top: 4px;
}

.btn-ghost {
  height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--sq-blue);
  font-size: 14px;
  border: 1px solid var(--sq-border);
}

.btn-ghost:hover {
  background: var(--sq-blue-soft);
}

.login-hint {
  margin: 16px 0 0;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  color: var(--sq-muted);
}

/* —— Booking shell: aside nav + content —— */
.view-booking {
  min-height: 100dvh;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--sq-bg);
}

.booking-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-top: env(safe-area-inset-top);
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.booking-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--sq-blue-deep);
}

.booking-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
}

.booking-aside {
  padding: 14px;
  background: var(--sq-card);
  border-radius: var(--sq-radius);
  box-shadow: 0 2px 12px rgba(15, 79, 168, 0.06);
}

.booking-user {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--sq-muted);
  word-break: break-all;
}

.booking-nav {
  display: flex;
  gap: 8px;
}

.nav-item {
  flex: 1;
  height: 40px;
  border: 1px solid var(--sq-border);
  border-radius: 8px;
  background: #fff;
  color: var(--sq-text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-item.is-active {
  background: var(--sq-blue);
  border-color: var(--sq-blue);
  color: #fff;
  font-weight: 600;
}

.nav-item:hover:not(.is-active) {
  background: var(--sq-blue-soft);
  border-color: var(--sq-blue);
  color: var(--sq-blue-deep);
}

.booking-main {
  min-width: 0;
}

.content-panel[hidden] {
  display: none !important;
}

.booking-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
}


.booking-panel {
  padding: 16px;
  background: var(--sq-card);
  border-radius: var(--sq-radius);
  box-shadow: 0 2px 12px rgba(15, 79, 168, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--sq-border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  color: var(--sq-text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select {
  height: 44px;
  padding-top: 0;
  padding-bottom: 0;
}

.field textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.45;
}

.field select:focus,
.field textarea:focus {
  border-color: var(--sq-blue);
  box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.15);
}

.fieldset-inline {
  border: none;
  margin: 0;
  padding: 0;
}

.fieldset-inline legend {
  padding: 0;
  margin-bottom: 6px;
}

.radio-row {
  display: flex;
  gap: 16px;
  align-items: center;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  cursor: pointer;
}

.radio-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--sq-blue);
}

.companion-field {
  margin-top: 8px;
}

.advanced-settings {
  border-top: 1px solid var(--sq-border);
  padding-top: 10px;
}

.advanced-settings summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--sq-blue);
  font-weight: 500;
  user-select: none;
  list-style: none;
}

.advanced-settings summary::-webkit-details-marker {
  display: none;
}

.advanced-settings summary::before {
  content: "▸ ";
}

.advanced-settings[open] summary::before {
  content: "▾ ";
}

.advanced-settings .field {
  margin-top: 10px;
}

/* —— Calendar —— */
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--sq-text);
}

.cal-nav {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  font-size: 12px;
  color: var(--sq-muted);
}

.cal-weekdays span {
  padding: 4px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--sq-text);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.cal-cell:hover:not(:disabled):not(.is-selected) {
  background: var(--sq-blue-soft);
}

.cal-cell.is-empty {
  visibility: hidden;
  pointer-events: none;
}

.cal-cell.is-selected {
  background: var(--sq-blue);
  color: #fff;
  font-weight: 600;
}

.cal-cell.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1.5px var(--sq-blue);
  color: var(--sq-blue-deep);
}

.chips-block {
  margin-top: 4px;
}

.chips-label {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--sq-muted);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 10px;
  background: var(--sq-blue-soft);
  color: var(--sq-blue-deep);
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.3;
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--sq-blue-deep);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.chip-remove:hover {
  background: rgba(26, 111, 212, 0.18);
}

.chips-empty {
  margin: 0;
  font-size: 13px;
  color: var(--sq-muted);
}

.chips-empty[hidden] {
  display: none !important;
}

/* —— Results —— */
.booking-results {
  max-width: 560px;
  margin: 16px 0 0;
  padding: 16px;
  background: var(--sq-card);
  border-radius: var(--sq-radius);
  box-shadow: 0 2px 12px rgba(15, 79, 168, 0.06);
}

.booking-results[hidden] {
  display: none !important;
}

.results-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--sq-text);
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  border-left: 3px solid transparent;
}

.result-item.is-ok {
  background: #e8f7ee;
  border-left-color: #2a9d5c;
  color: #1a6b3c;
}

.result-item.is-fail {
  background: #fceeee;
  border-left-color: var(--sq-danger);
  color: #8a2a2a;
}

.result-date {
  font-weight: 600;
}

.result-msg {
  font-size: 13px;
  opacity: 0.9;
}

.reservation-panel {
  max-width: 560px;
  margin: 0;
}

.reservation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.reservation-head .results-title {
  margin: 0;
}

.reservation-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--sq-muted);
}

.reservation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reservation-item {
  padding: 12px;
  border-radius: 8px;
  background: #f5f8fc;
  border: 1px solid var(--sq-line, #e2eaf4);
}

.reservation-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--sq-text);
}

.reservation-detail {
  margin-top: 4px;
  font-size: 12px;
  color: var(--sq-muted, #6b7c93);
  line-height: 1.4;
  word-break: break-all;
}

@media (min-width: 720px) {
  .booking-shell {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
  }

  .booking-aside {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 16px;
  }

  .booking-nav {
    flex-direction: column;
  }

  .nav-item {
    flex: none;
    width: 100%;
  }

  .booking-main {
    flex: 1;
  }
}

@media (min-width: 480px) {
  .login-card {
    padding: 32px 28px 26px;
  }

  .view-booking {
    padding-left: 24px;
    padding-right: 24px;
  }
}
