:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d9dee5;
  --red: #e11d2e;
  --gold: #a97824;
  --black: #050505;
  --soft: #f8fafc;
  --focus: #2563eb;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--black);
  color: #fff;
  padding: 34px 14px;
}

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .18em;
  margin: 0 8px 34px;
}

nav {
  display: grid;
  gap: 4px;
}

nav button {
  min-height: 46px;
  border: 0;
  border-radius: 2px;
  color: rgba(255, 255, 255, .68);
  background: transparent;
  text-align: left;
  padding: 0 16px;
  font-weight: 700;
  transition: background .14s ease, color .14s ease;
}

nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

nav button.active {
  color: var(--black);
  background: #fff;
}

.main {
  min-width: 0;
  padding: 34px 36px 42px;
}

header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
}

h1 {
  margin: 6px 0 0;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: 0;
}

#pageDesc {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#apiStatus {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

#refresh,
#logout,
.form-actions button,
.inline-form button {
  min-height: 42px;
  padding: 0 20px;
  border-radius: 3px;
  border: 1px solid var(--black);
  color: #fff;
  background: var(--black);
  font-weight: 800;
  transition: transform .12s ease, background .14s ease, border-color .14s ease;
}

.ghost {
  border-color: var(--line) !important;
  color: var(--ink) !important;
  background: var(--surface) !important;
}

#refresh:hover,
#logout:hover,
.form-actions button:hover,
.inline-form button:hover,
.primary-action:hover,
.mini-action:hover {
  background: #1f2937;
  border-color: #1f2937;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 20px;
}

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

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #050505;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 36px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .34);
}

.auth-brand {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .2em;
}

.auth-card h1 {
  margin: 0;
  font-size: 34px;
}

.auth-card p {
  margin: -8px 0 2px;
  color: var(--muted);
}

.auth-card label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.auth-card input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 3px;
  outline: none;
}

.auth-card input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.auth-card button {
  min-height: 48px;
  border: 1px solid var(--black);
  border-radius: 3px;
  color: #fff;
  background: var(--black);
  font-weight: 800;
}

.auth-card button:disabled {
  cursor: wait;
  opacity: .55;
}

.auth-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

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

.metrics .metric-link,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 22px;
}

.metrics .metric-link {
  width: 100%;
  color: inherit;
  background: var(--surface);
  text-align: left;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.metrics .metric-link:hover {
  border-color: var(--ink);
  box-shadow: 0 5px 14px rgba(17, 24, 39, .08);
  transform: translateY(-2px);
}

.metrics .metric-link:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .24);
  outline-offset: 2px;
  border-color: var(--focus);
}

.panel {
  box-shadow: 0 1px 0 rgba(17, 24, 39, .03);
}

.metrics span {
  display: block;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
}

.metrics p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 18px;
}

.panel-title {
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 18px;
}

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

.task-list div {
  min-height: 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.task-list div:last-child {
  border-bottom: 0;
}

.kv {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px 16px;
  margin: 0;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  word-break: break-word;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px 20px;
  align-items: start;
}

.editor-panel {
  border-left: 4px solid var(--black);
}

.compact-form {
  align-items: end;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px 18px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  border-radius: 3px;
}

.service-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
}

.service-hero-grid section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--soft);
}

.service-hero-grid .image-detail {
  grid-template-columns: 1fr;
  padding: 12px;
  background: #fff;
}

.service-hero-grid .image-preview-box {
  min-height: 150px;
}

.service-hero-grid .image-preview-box img {
  height: 150px;
}

.service-hero-grid .image-meta {
  grid-template-columns: 58px 1fr;
  font-size: 12px;
}

.service-hero-grid .image-meta dt:nth-of-type(n + 5),
.service-hero-grid .image-meta dd:nth-of-type(n + 5) {
  display: none;
}

.image-detail {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--soft);
}

.image-preview-box {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
  background: #0b0b0b;
}

.image-preview-box img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.image-empty {
  color: rgba(255, 255, 255, .66);
  font-size: 13px;
}

.image-error .image-preview-box {
  background: #2b1111;
}

.image-info {
  min-width: 0;
}

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

.image-actions strong {
  font-size: 16px;
}

.small-button {
  min-height: 32px !important;
  padding: 0 12px !important;
  white-space: nowrap;
}

.image-meta {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 9px 12px;
  align-content: start;
  margin: 0;
  min-width: 0;
}

.image-meta dt {
  color: var(--muted);
}

.image-meta dd {
  margin: 0;
  min-width: 0;
  word-break: break-all;
}

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

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

input,
select {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 10px 11px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .11);
}

input:disabled,
select:disabled,
textarea:disabled {
  color: #98a2b3;
  background: #f8fafc;
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 6px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
  gap: 18px 20px;
  align-items: end;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(130px, .65fr) minmax(150px, .75fr) minmax(160px, .8fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--soft);
}

.filter-bar button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-weight: 800;
}

.form-section-title {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

.booking-board {
  overflow: hidden;
  padding: 24px;
}

.booking-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.booking-overview .booking-metric {
  min-height: 96px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--black);
  border-radius: 3px;
  background: #fff;
  color: inherit;
  text-align: left;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.booking-overview .booking-metric:hover {
  border-color: var(--ink);
  box-shadow: 0 5px 14px rgba(17, 24, 39, .08);
  transform: translateY(-2px);
}

.booking-overview .booking-metric:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .24);
  outline-offset: 2px;
  border-color: var(--focus);
}

.booking-overview strong {
  display: block;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 0;
}

.booking-overview span {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.booking-schedule {
  display: grid;
  gap: 12px;
}

.schedule-day {
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

.schedule-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.schedule-day-head strong {
  font-size: 18px;
}

.schedule-day-head span,
.slot-time span {
  color: var(--muted);
  font-size: 13px;
}

.schedule-slot {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 0;
  align-items: start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.schedule-slot:last-child {
  border-bottom: 0;
}

.slot-time {
  display: grid;
  gap: 6px;
  color: var(--ink);
  padding-top: 4px;
}

.slot-time strong {
  font-size: 20px;
  line-height: 1;
}

.slot-orders {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.schedule-order {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--black);
  border-radius: 3px;
  background: #fff;
}

.schedule-order strong,
.schedule-order span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-order strong {
  font-size: 15px;
}

.schedule-order span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.schedule-order-foot em {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 2px;
  padding: 0 9px;
  color: var(--ink);
  background: #eef2f6;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.badge-warning,
.schedule-order-foot em.badge-warning {
  color: #92400e;
  background: #fff7ed;
}

.badge-info,
.schedule-order-foot em.badge-info {
  color: #1e3a8a;
  background: #eff6ff;
}

.badge-active,
.schedule-order-foot em.badge-active {
  color: #075985;
  background: #e0f2fe;
}

.badge-success,
.schedule-order-foot em.badge-success {
  color: #166534;
  background: #ecfdf3;
}

.badge-muted,
.schedule-order-foot em.badge-muted {
  color: #475467;
  background: #f2f4f7;
}

.mini-action,
.primary-action,
.danger-action {
  border: 1px solid #050505;
  font-weight: 800;
  letter-spacing: 0;
}

.mini-action,
.primary-action {
  color: #fff;
  background: #050505;
}

.mini-action {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
}

.primary-action {
  min-height: 36px !important;
  border-radius: 3px !important;
}

.danger-action {
  color: var(--red) !important;
  border-color: #f2b9bf !important;
  background: #fff !important;
}

.quick-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-action:disabled,
.primary-action:disabled,
.danger-action:disabled {
  opacity: .55;
  cursor: default;
}

.order-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-actions select {
  min-width: 136px;
}

.table-panel {
  overflow: auto;
  padding: 24px;
}

.table-panel .panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.thumb {
  width: 76px;
  height: 56px;
  display: block;
  object-fit: cover;
  border-radius: 3px;
  background: #e9eef4;
}

.empty-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--soft);
}

th:first-child {
  border-left: 1px solid var(--line);
}

th:last-child {
  border-right: 1px solid var(--line);
}

th:first-child {
  border-top-left-radius: 3px;
}

th:last-child {
  border-top-right-radius: 3px;
}

tbody tr:hover {
  background: #f8fafc;
}

td strong {
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 2px;
  padding: 0 9px;
  color: var(--ink);
  background: #eef2f6;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.link {
  border: 0;
  color: var(--red);
  background: transparent;
  padding: 0;
  font-weight: 700;
  white-space: nowrap;
}

code {
  padding: 3px 6px;
  border-radius: 3px;
  background: #eef2f6;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px !important;
}

.toast {
  position: fixed;
  right: 24px;
  top: 22px;
  z-index: 5;
  min-width: 180px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 3px;
  color: #fff;
  background: #050505;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 24, 39, .48);
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(17, 24, 39, .24);
}

#checkInForm {
  display: grid;
  gap: 20px;
  padding: 26px;
}

.entitlement-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid #d7dde7;
  border-left: 4px solid var(--ink);
  background: var(--soft);
}

.entitlement-summary strong,
.entitlement-summary span {
  display: block;
}

.entitlement-summary span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.modal-form {
  display: grid;
  gap: 20px;
  padding: 26px;
}

.compact-modal-card {
  width: min(680px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.modal-head h2 {
  margin: 4px 0 8px;
  font-size: 28px;
  line-height: 1.15;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  background: #fff;
  font-size: 24px;
  line-height: 1;
}

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

.settlement-options label {
  min-height: 96px;
  display: grid;
  gap: 7px;
  align-content: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.settlement-options input {
  display: none;
}

.settlement-options label:has(input:checked) {
  border-color: var(--black);
  color: #fff;
  background: var(--black);
}

.settlement-options span {
  font-size: 17px;
  font-weight: 800;
}

.settlement-options small {
  color: currentColor;
  opacity: .68;
  font-size: 12px;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.modal-actions button {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--black);
  border-radius: 3px;
  color: #fff;
  background: var(--black);
  font-weight: 800;
}

@media (max-width: 1280px) {
  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .booking-overview {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .main {
    padding: 22px;
  }

  header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .split,
  .form-grid,
  .inline-form,
  .filter-bar,
  .booking-overview,
  .schedule-slot,
  .image-detail {
    grid-template-columns: 1fr;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .settlement-options {
    grid-template-columns: 1fr;
  }
}
