:root {
  font-family: 'Microsoft YaHei UI', 'PingFang SC', 'Noto Sans CJK SC', system-ui, sans-serif;
  line-height: 1.5;
  color: #192831;
  background: #f1f5f6;
  --ink: #192831;
  --muted: #526873;
  --border: #dbe5e8;
  --surface: #fff;
  --accent: #086f68;
  --accent-dark: #075a54;
  --tint: #e6f4f1;
  --sidebar: #13262d;
  --mono: Consolas, 'SFMono-Regular', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-dark); text-underline-offset: .19em; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid #278a81; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); line-height: 1.18; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { font-size: 1.125rem; line-height: 1.35; }
.muted { color: var(--muted); }
.code { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 222px minmax(0, 1fr); }
.sidebar { color: #d9e7e8; background: var(--sidebar); display: flex; flex-direction: column; gap: 36px; padding: 32px 18px 20px; position: sticky; top: 0; height: 100vh; }
.brand { text-decoration: none; color: #fff; display: flex; align-items: center; gap: 12px; padding-inline: 8px; font-size: 1.125rem; font-weight: 750; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #b4e9db; color: #123d37; font: 700 1.5rem/1 var(--mono); flex: 0 0 auto; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; border-radius: 8px; padding: 11px 12px; color: #c2d5d9; font-size: .95rem; text-decoration: none; }
.sidebar nav a span { width: 1.1rem; text-align: center; }
.sidebar nav a:hover { background: #254148; color: #fff; }
.sidebar nav [aria-current=page] { background: #294b50; color: #e9fff9; font-weight: 700; }
.session { margin-top: auto; display: flex; gap: 8px; justify-content: space-between; align-items: center; border-top: 1px solid #355057; padding: 14px 6px 0; }
.session-user { font-size: .875rem; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.text-button { color: inherit; border: 0; background: transparent; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; padding: 6px 3px; white-space: nowrap; }

.main-content { width: 100%; max-width: 1510px; padding: 44px clamp(22px, 3.5vw, 54px) 48px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 18px; margin-bottom: 24px; }
.page-heading p { margin-top: 8px; color: var(--muted); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: .35rem; min-height: 42px; border: 1px solid transparent; border-radius: 8px; padding: 8px 15px; cursor: pointer; text-decoration: none; font-size: .9375rem; font-weight: 650; white-space: nowrap; }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-dark); }
.secondary-button { border-color: #cbdcdf; color: var(--accent-dark); background: var(--surface); }
.secondary-button:hover { background: var(--tint); border-color: #a3cfc6; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notice { padding: 12px 16px; margin-bottom: 16px; border: 1px solid #a4d6c8; background: var(--tint); border-radius: 8px; }

.overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.metric:hover { border-color: #95c5bd; }
.metric strong { font: 650 1.55rem/1.1 var(--mono); color: var(--ink); }
.panel { border: 1px solid var(--border); border-radius: 13px; background: var(--surface); min-width: 0; }
.search-form { display: grid; gap: 12px; padding: 18px 20px; }
.search-main { display: flex; gap: 8px; }
.search-main input { flex: 1; min-width: 0; background: #f7fafb; }
.search-main .button { min-width: 82px; }
input:not([type=checkbox]), select, textarea { border: 1px solid #c6d7db; border-radius: 8px; padding: 8px 11px; min-height: 40px; color: var(--ink); background: var(--surface); min-width: 0; }
input::placeholder { color: var(--muted); opacity: 1; }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.filters label { display: inline-flex; align-items: center; gap: 7px; font-size: .875rem; font-weight: 650; }
.filters select { max-width: 145px; }
.filters input { width: 127px; }
.reset { font-size: .875rem; }
.result-heading { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.result-heading:first-child { border-top: 0; }
.result-heading .muted { font-size: .875rem; }
.table-scroll { overflow-x: auto; min-width: 0; }
table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
th, td { padding: 11px 14px; text-align: left; vertical-align: middle; border-top: 1px solid #e6edf0; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
thead th { color: #425961; background: #f5f8f9; font-size: .875rem; font-weight: 700; white-space: nowrap; }
tbody tr:hover { background: #fbfefe; }
.row-title { color: var(--ink); font-weight: 700; text-decoration: none; }
.row-title:hover { color: var(--accent-dark); text-decoration: underline; }
.secondary { color: var(--muted); margin-top: 2px; font-size: .875rem; }
.slot-list { display: flex; flex-wrap: wrap; gap: 5px; }
.slot-code { display: inline-block; color: #145c54; background: var(--tint); border: 1px solid #cee9e1; padding: 2px 7px; border-radius: 5px; font-family: var(--mono); white-space: nowrap; text-decoration: none; }
.slot-code:hover { background: #d5eee7; text-decoration: underline; }
.status { display: inline-block; border-radius: 5px; padding: 2px 6px; font-size: .8125rem; font-weight: 650; white-space: nowrap; margin-top: 3px; }
.pending { color: #784419; background: #fff2d9; }
.empty { text-align: center; padding-block: 38px; color: var(--muted); }
.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 14px; padding: 14px 18px; color: var(--muted); border-top: 1px solid var(--border); }

.box-layout { display: grid; grid-template-columns: minmax(0, 2.9fr) minmax(200px, 1fr); gap: 16px; align-items: start; }
.box-panel { padding: 16px 12px 14px; }
.box-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-inline: 5px; }
.box-tabs a { padding: 7px 13px; text-decoration: none; border-radius: 7px; }
.box-tabs [aria-current=page] { background: var(--tint); color: var(--accent-dark); font-weight: 750; }
.box-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 15px 5px 7px; }
.slot-map { border-collapse: separate; border-spacing: 5px; table-layout: fixed; min-width: 520px; }
.slot-map th, .slot-map td { padding: 0; border: 0; }
.slot-map th { text-align: center; background: transparent; white-space: nowrap; color: var(--muted); font-size: .875rem; }
.slot-map th:first-child { width: 52px; }
.slot-map td { vertical-align: top; }
.tile { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-height: 67px; padding: 7px 9px; background: #f6f8f9; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.tile .code { font-weight: 700; font-size: .9375rem; }
.tile strong { color: var(--ink); line-height: 1.3; }
.tile.occupied { color: var(--accent-dark); background: var(--tint); border-color: #cae5dd; }
.tile:hover, .tile.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tile.missing { border-style: dashed; }
.tile.missing:hover { box-shadow: none; border-color: var(--border); }
.slot-detail { padding: 17px; }
.slot-detail h2, .slot-detail p { margin-bottom: 9px; }
.slot-entry { padding: 9px 0 13px; }
.slot-entry > a:last-child { display: inline-block; margin-top: 6px; }

.back-link { display: inline-block; margin-bottom: 15px; font-size: .9375rem; }
.detail-layout { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.content-panel { padding: 19px 21px; }
.content-panel h2 { margin-bottom: 11px; }
.content-panel .actions { margin-top: 13px; }
.details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.quote { font-size: 1.5rem; font-weight: 750; }
.quote span { font-size: .9375rem; font-weight: 500; }
.spaced-panel { margin-top: 16px; }

.stack-form { display: grid; gap: 14px; }
.edit-form { max-width: 680px; }
.form-field { display: grid; gap: 5px; }
.form-field label { font-size: .9375rem; font-weight: 650; }
.checkbox-field label { display: inline-flex; align-items: center; gap: 8px; }
.errorlist { padding: 8px 10px; margin: 0; border-radius: 6px; list-style: none; background: #fce9e9; color: #8c2626; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 22% 18%, #315c5c, #13262d 70%); }
.login-panel { width: min(100%, 440px); background: var(--surface); border-radius: 15px; padding: clamp(23px, 6vw, 36px); box-shadow: 0 14px 50px #0003; }
.login-panel h1 { margin-top: 14px; }
.login-panel p { margin-top: 9px; }
.login-panel form { margin-top: 21px; }
.login-panel .button { margin-top: 4px; }

@media (max-width: 1040px) {
  .box-layout { grid-template-columns: 1fr; }
}
@media (max-width: 830px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 12px 15px; gap: 8px 14px; flex-wrap: wrap; flex-direction: row; align-items: center; }
  .brand { padding: 0; }
  .brand-mark { width: 33px; height: 33px; }
  .sidebar nav { display: flex; margin-right: auto; }
  .sidebar nav a { padding: 8px; gap: 6px; }
  .session { margin-top: 0; padding: 0; border: 0; }
  .session-user { max-width: 100px; }
  .main-content { padding-top: 25px; }
}
@media (max-width: 560px) {
  .sidebar nav a span, .session-user { display: none; }
  .sidebar { padding-inline: 11px; column-gap: 8px; }
  .brand { font-size: .95rem; gap: 6px; }
  .sidebar nav a { font-size: .875rem; padding: 7px 5px; }
  .main-content { padding-inline: 12px; }
  .overview { gap: 6px; }
  .metric { display: grid; gap: 5px; padding: 8px 9px; font-size: .875rem; }
  .search-form { padding-inline: 12px; }
  table:not(.slot-map) { min-width: 530px; }
  .detail-layout { grid-template-columns: 1fr; }
}
