:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d9dee7;
  --muted: #687386;
  --text: #152033;
  --accent: #1769e0;
  --accent-strong: #0d4fb3;
  --success: #127c45;
  --warning: #9a5b00;
  --shadow: 0 10px 28px rgba(21, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

.app-frame {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #111827;
  color: #eef3fb;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 24px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #111827;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: #aeb7c6;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #c9d2e1;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #23314a;
  color: #ffffff;
}

.nav-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: inherit;
  font-weight: 700;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

.topbar p,
.section-title span,
.reserved-layout p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid #c9d8f2;
  border-radius: 999px;
  padding: 8px 12px;
  background: #edf4ff;
  color: #164b91;
  font-size: 13px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
}

.upload-panel,
.summary-panel,
.table-wrap,
.reserved-layout,
.settings-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 22px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.upload-form {
  display: grid;
  gap: 16px;
}

.drop-zone {
  display: grid;
  min-height: 190px;
  place-items: center;
  border: 1px dashed #9eb4d4;
  border-radius: 8px;
  padding: 24px;
  background: #f8fbff;
  text-align: center;
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: #eef6ff;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
}

.drop-zone strong {
  margin-top: 12px;
}

.drop-zone small {
  margin-top: 8px;
  color: var(--muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd4e1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

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

textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.action-row,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary,
.secondary {
  height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

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

.secondary {
  border: 1px solid #cbd4e1;
  background: #ffffff;
  color: #344054;
}

#uploadMessage {
  color: var(--muted);
  font-size: 13px;
}

.summary-panel {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
}

.metric-card {
  border: 1px solid #e2e7ef;
  border-radius: 8px;
  padding: 16px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar input {
  max-width: 360px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid #e6ebf2;
  padding: 13px 14px;
  text-align: left;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #526074;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #ecfdf3;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.badge.pending {
  background: #fff7e6;
  color: var(--warning);
}

.table-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.reserved-layout,
.settings-panel {
  padding: 24px;
}

.token-field {
  display: block;
  max-width: 520px;
  margin-top: 18px;
}

.settings-actions {
  margin-top: 12px;
}

#tokenMessage {
  color: var(--muted);
  font-size: 13px;
}

.reserved-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.reserved-grid div {
  border: 1px dashed #a9b6c8;
  border-radius: 8px;
  padding: 18px;
  background: #f8fafc;
  color: #526074;
  text-align: center;
  font-weight: 700;
}

dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px 18px;
  margin: 18px 0 0;
}

dt {
  color: #526074;
  font-weight: 700;
}

dd {
  margin: 0;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .brand {
    padding-bottom: 14px;
  }

  .content-grid,
  .form-row,
  .reserved-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .section-title,
  .action-row,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}
