:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #66717e;
  --line: #e3e8ed;
  --surface: #ffffff;
  --page: #f2f5f7;
  --blue: #215a75;
  --blue-soft: #e8f1f5;
  --green: #27735a;
  --green-soft: #e7f3ee;
  --red: #c54747;
  --red-soft: #fff0ef;
  --shadow: 0 16px 45px rgba(25, 51, 65, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 0%, rgba(48, 121, 150, 0.10), transparent 28rem),
    var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button { font: inherit; }

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.metrics {
  display: flex;
  align-items: baseline;
  gap: 22px;
  margin: 0 4px 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.metrics strong { color: var(--ink); font-size: 1.45rem; line-height: 1; }

.building-list { display: grid; gap: 16px; }

.building-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(25, 51, 65, 0.035);
}

.building-card[open] { box-shadow: var(--shadow); }

.building-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 19px 22px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.building-header::-webkit-details-marker { display: none; }

.building-name { flex: 1; font-size: 1.1rem; font-weight: 750; }
.chevron { display: grid; place-items: center; width: 32px; height: 32px; }
.chevron::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid #82919b;
  border-bottom: 2px solid #82919b;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 180ms ease;
}
.building-card[open] .chevron::before { transform: translateY(2px) rotate(-135deg); }

.company-list { border-top: 1px solid var(--line); }
.company-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 190px 32px;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 17px 22px;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}
.company-row:last-child { border-bottom: 0; }
.company-row:hover, .company-row:focus-visible { background: #f7fafb; outline: none; }
.company-row:focus-visible { box-shadow: inset 3px 0 var(--blue); }

.company-name { font-weight: 700; line-height: 1.45; }
.company-main { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; min-width: 0; }
.room-number { color: #929ca4; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.02em; }
.company-type { width: fit-content; padding: 4px 9px; border-radius: 6px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.type-food { color: #9a4b1b; background: #fff0e3; }
.type-creative { color: #4763a2; background: #eaf0ff; }
.type-studio { color: #4d6180; background: #e9eef4; }
.type-material { color: #32705f; background: #e4f3ed; }
.type-fashion { color: #8b4f76; background: #f7e8f1; }
.type-other { color: #626b73; background: #edf0f2; }
.company-id { color: #8b959e; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.82rem; }
.company-id.pending { color: var(--red); font-family: inherit; font-weight: 750; }
.people-count { color: var(--muted); font-size: 0.88rem; }
.row-arrow { display: grid; place-items: center; width: 32px; height: 32px; }
.row-arrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 2px solid #9aa5ad;
  border-right: 2px solid #9aa5ad;
  transform: translateX(-2px) rotate(45deg);
}

.company-dialog {
  width: min(500px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(8, 25, 35, 0.28);
}
.company-dialog::backdrop { background: rgba(20, 34, 43, 0.48); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 26px 28px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 1.35rem; line-height: 1.4; }
.close-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f0f3f5; color: #596772; cursor: pointer; font-size: 1.45rem; line-height: 1; }
.close-button:hover { background: #e5eaed; }
.close-button:focus-visible { outline: 3px solid rgba(33, 90, 117, 0.28); }
.dialog-body { padding: 8px 28px 28px; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 0; border-bottom: 1px solid #edf0f2; }
.detail-row span { color: var(--muted); }
.detail-row strong { text-align: right; }
.registration-total { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; padding: 20px; border-radius: 14px; background: var(--blue-soft); color: var(--blue); }
.registration-total strong { font-size: 1rem; }
.registration-total b { font-size: 2rem; line-height: 1; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 24px, 620px); padding-top: 24px; }
  .building-header { padding: 16px; }
  .company-row { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 16px; }
  .company-id { grid-column: 1; }
  .people-count { grid-column: 1; }
  .row-arrow { grid-column: 2; grid-row: 1 / span 3; align-self: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
