:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #dde5f0;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eaf1ff;
  --green: #15945b;
  --amber: #b7791f;
  --red: #d14343;
  --shadow: 0 18px 48px rgba(27, 39, 70, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 34%),
    var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  grid-column: 1 / -1;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar h1,
.modal h2,
.section-title h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.avatar-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--text);
}

.menu-toggle {
  display: none;
  gap: 4px;
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  background: currentColor;
  display: block;
}

.avatar-button {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 800;
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 20px;
  background: rgba(255, 255, 255, 0.94);
  overflow-y: auto;
}

.brand-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #f0f5ff;
  border: 1px solid #cfe0ff;
  border-radius: 8px;
}

.brand-panel span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.nav-item {
  border: 0;
  text-align: left;
  border-radius: 8px;
  padding: 13px 14px;
  background: transparent;
  color: var(--muted);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-item.active,
.nav-item:hover {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  transform: translateX(2px);
}

.sync-card {
  margin-top: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  gap: 10px;
  color: var(--muted);
}

.sync-card strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
}

.sync-card p {
  margin: 0;
  font-size: 13px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  margin-top: 5px;
}

.main {
  min-width: 0;
  padding: 28px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  scroll-behavior: smooth;
}

.hero {
  min-height: 310px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: end;
  background:
    linear-gradient(180deg, rgba(12, 20, 35, 0.08), rgba(12, 20, 35, 0.74)),
    url("./assets/home.jpg") center / cover;
  color: white;
  padding: 30px;
  box-shadow: var(--shadow);
}

.hero h2 {
  max-width: 680px;
  margin: 0 0 10px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1;
}

.hero p {
  max-width: 640px;
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 16px;
}

.toolbar,
.section-title,
.split-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  justify-content: space-between;
  margin: 28px 0 16px;
}

.toolbar {
  margin: 18px 0;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  min-height: 42px;
}

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

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

.section-title h2,
.section-title h3 {
  letter-spacing: 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.055);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-1px);
  border-color: #cbd7ea;
  box-shadow: var(--shadow);
}

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

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

.room-card .thumb,
.cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 14px;
  background: #eef2f7;
}

.detail-card .cover {
  aspect-ratio: 4 / 3;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2f7;
  color: #475467;
  font-size: 13px;
}

.tag.good {
  background: #e9f8f1;
  color: var(--green);
}

.tag.warn {
  background: #fff7e6;
  color: var(--amber);
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.08);
}

.primary-button {
  background: var(--primary);
  color: white;
}

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

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  background: #fff5f5;
  border-color: #ffd7d7;
  color: var(--red);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
  background: #f8fafc;
}

tr:last-child td {
  border-bottom: 0;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid textarea {
  min-height: 92px;
  resize: vertical;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

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

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 18px;
}

.tabs button,
.calendar-strip button,
.slot-grid button,
.mini-list button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.tabs button {
  min-height: 40px;
  padding: 0 12px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tabs button.active,
.tabs button[aria-selected="true"],
.calendar-strip button.active {
  border-color: var(--primary);
  background: #eef4ff;
  color: var(--primary);
  font-weight: 700;
}

.tabs button.active,
.tabs button[aria-selected="true"] {
  box-shadow: inset 0 -2px 0 var(--primary);
}

.calendar-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.calendar-strip button {
  padding: 10px;
  display: grid;
  gap: 4px;
}

.calendar-strip span {
  color: var(--muted);
  font-size: 13px;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.slot-grid button {
  min-height: 62px;
  display: grid;
  gap: 4px;
  padding: 8px;
}

.slot-grid button.busy {
  background: #f8fafc;
  color: #98a2b3;
  cursor: not-allowed;
}

.slot-grid span {
  font-size: 12px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  color: var(--text);
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.mini-list button,
.mini-list span {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
}

.article {
  max-width: 860px;
}

.article-content {
  line-height: 1.8;
  color: var(--text);
  margin: 18px 0;
}

.compact {
  margin: 0 0 12px;
}

.admin-login {
  max-width: 460px;
  margin: 28px auto;
}

.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  margin-bottom: 18px;
}

.profile-left .card {
  text-align: center;
  padding: 24px;
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 800;
  margin: 0 auto 16px;
}

.profile-left h3 {
  margin: 0 0 8px;
}

.profile-left p {
  margin: 0 0 16px;
  color: var(--muted);
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-actions button {
  width: 100%;
}

.profile-right {
  min-width: 0;
}

.profile-right .section-title.compact {
  margin-bottom: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.modal[aria-hidden="false"] {
  display: flex;
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding-top: 10vh;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 38, 0.45);
  z-index: -1;
}

.modal-panel {
  position: relative;
  width: min(460px, calc(100% - 28px));
  max-height: calc(90vh - 28px);
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.close-button {
  font-size: 24px;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  top: 88px;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 80;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  animation: toastIn 0.18s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.empty {
  padding: 30px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.log-list {
  display: grid;
  gap: 8px;
}

.log-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
}

.log-time {
  color: var(--muted);
  white-space: nowrap;
}

.log-text {
  color: var(--text);
}

.form {
  max-width: 600px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
}

.form-group input,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  min-height: 42px;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-actions {
  margin-top: 20px;
}

.login-panel {
  width: min(480px, calc(100% - 28px));
}

.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.login-tab {
  flex: 1;
  min-height: 42px;
  border: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 600;
}

.login-tab.active {
  background: var(--primary);
  color: white;
}

.login-footer {
  margin-top: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.admin-only[hidden] {
  display: none;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: grid;
  }

  .sidebar {
    position: fixed;
    inset: 72px auto 0 0;
    width: min(300px, 86vw);
    z-index: 40;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open::after {
    content: "";
    position: fixed;
    inset: 0;
    left: min(300px, 86vw);
    background: rgba(15, 23, 42, 0.28);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    padding: 18px;
  }

  .topbar {
    padding: 10px 14px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .hero {
    min-height: 260px;
    padding: 22px;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 12px;
  }

  .section-title {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

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

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

  table {
    min-width: 500px;
  }

  .form-grid {
    gap: 12px;
  }

  .login-panel {
    padding: 16px;
  }

  .login-tabs {
    margin-bottom: 12px;
  }

  .detail-card {
    padding: 12px;
  }

  .slot-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tabs button {
    flex: 1 1 auto;
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .hero {
    min-height: 200px;
    padding: 16px;
  }

  .hero h2 {
    font-size: 20px;
  }

  .hero p {
    font-size: 13px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

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

  .inline-actions {
    flex-direction: column;
    gap: 4px;
  }

  .inline-actions button {
    width: 100%;
  }
}
