/* ============ 登录界面 ============ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(150deg, #8f1d1d 0%, #6d1414 55%, #4d0f0f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-screen.hidden {
  display: none;
}

.login-box {
  background: #fff;
  border-radius: var(--r-lg);
  padding: 34px 30px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  text-align: center;
}

.login-seal {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff2d4, #e5c07a);
  color: var(--red-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  margin: 0 auto 14px;
  box-shadow: 0 4px 14px rgba(176, 141, 79, 0.4);
}

.login-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: 2px;
}

.login-sub {
  font-size: 12.5px;
  color: var(--text-3);
  margin: 0 0 20px;
}

/* 登录表单 */
.login-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.login-error {
  font-size: 12.5px;
  color: #b03c3c;
  min-height: 17px;
  line-height: 1.4;
}

.admin-btn.block {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  height: 42px;
}

.admin-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ============ 后台专用 ============ */
.admin-body {
  background: #f7f2ec;
}

.admin-user {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.62);
  padding-right: 4px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-bar {
  position: sticky;
  top: 67px;
  z-index: 50;
  background: rgba(247, 242, 236, 0.95);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.admin-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.admin-bar .search-box {
  max-width: 280px;
}

.admin-stat {
  font-size: 12.5px;
  color: var(--text-3);
  flex: 1;
}

.admin-stat b {
  color: var(--ink);
  font-weight: 600;
}

.admin-bar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.admin-btn {
  padding: 8px 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  transition: all 0.15s;
  white-space: nowrap;
}

.admin-btn:hover {
  border-color: var(--gold);
  background: #fdfcf9;
}

.admin-btn.primary {
  background: linear-gradient(135deg, var(--red), var(--red-bright));
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 3px 10px rgba(198, 42, 31, 0.26);
}

.admin-btn.primary:hover {
  background: linear-gradient(135deg, var(--red-bright), var(--red));
  border-color: var(--red-bright);
}

.admin-btn.danger {
  background: #fff;
  border-color: rgba(180, 60, 60, 0.3);
  color: #b03c3c;
}

.admin-btn.danger:hover {
  background: #fdf2f2;
  border-color: #b03c3c;
}

.admin-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 70px;
}

/* 席位分区 */
.tier-block {
  margin-bottom: 30px;
}

.tier-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 13px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.tier-name {
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 1px;
}

.tier-count {
  font-size: 12px;
  color: var(--text-3);
}

.tier-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--gold-dim), transparent);
}

.tier-add {
  font-size: 12.5px;
  color: var(--text-3);
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px dashed var(--line);
  transition: all 0.15s;
}

.tier-add:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* 席位格 */
.seat-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
}

.seat-grid.solo {
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  max-width: 100%;
}

/* 单人级别：席位按内容宽度排，不留大片空白 */
.tier-block.single .seat-grid {
  grid-template-columns: repeat(auto-fill, minmax(142px, 220px));
}

.seat-grid.solo .seat {
  max-width: 220px;
}

.seat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 10px 10px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.16s;
}

.seat:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.seat.dragging {
  opacity: 0.4;
}

.seat.drop-target {
  border-color: var(--gold);
  border-style: dashed;
  background: #fdfbf6;
}

.seat-handle {
  position: absolute;
  top: 7px;
  left: 7px;
  cursor: grab;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 0;
}

.seat:hover .seat-handle {
  opacity: 1;
}

.seat-no {
  position: absolute;
  top: 7px;
  right: 8px;
  font-size: 10.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.seat-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin: 4px auto 8px;
  background: #eceae4;
  border: 2px solid #fff;
  box-shadow: 0 1px 6px rgba(26, 29, 36, 0.1);
}

.seat-avatar.solo {
  width: 72px;
  height: 72px;
  border-radius: 14px;
}

.seat-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-company {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 32px;
  margin-top: 4px;
}

.seat-title {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-flag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d9534f;
}

.seat.featured {
  border-color: rgba(201, 151, 63, 0.55);
  background: linear-gradient(150deg, #fffdf8, #fdf6ea);
}

.seat-star {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold-deep);
  font-size: 11px;
  line-height: 1;
}

/* 领导席区：金色底，突出显示 */
.tier-block.leaders .tier-name {
  color: var(--red);
}

.tier-block.leaders .tier-head {
  border-bottom-color: rgba(201, 151, 63, 0.4);
}

.leader-grid {
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
}

.leader-grid .seat {
  padding: 14px 12px 12px;
  background: linear-gradient(155deg, #fffdf8 0%, #fdf5e6 100%);
  border-color: rgba(201, 151, 63, 0.5);
}

.leader-grid .seat-avatar {
  width: 62px;
  height: 62px;
}

.leader-grid .seat-name {
  font-size: 14.5px;
}

.seat-role {
  font-size: 10.5px;
  color: var(--red);
  font-weight: 500;
  margin-bottom: 3px;
  line-height: 1.3;
}

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 27, 0.5);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal-mask.show {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 620px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  margin: auto 0;
}

.modal.wide {
  max-width: 860px;
}

.modal-head {
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  font-size: 22px;
  line-height: 1;
  color: var(--text-3);
  width: 28px;
  height: 28px;
  border-radius: 7px;
  transition: all 0.15s;
}

.modal-close:hover {
  background: #f2f1ed;
  color: var(--text);
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  max-height: 68vh;
}

.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 9px;
  align-items: center;
}

.spacer {
  flex: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

.field > span {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fdfcfb;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
  background: #fff;
}

.avatar-field {
  gap: 8px;
}

.avatar-upload {
  display: flex;
  gap: 14px;
  align-items: center;
}

.avatar-preview {
  width: 82px;
  height: 82px;
  border-radius: 12px;
  background: #f2f1ed;
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-3);
  font-size: 12px;
  flex-shrink: 0;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-tip {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 6px;
}

.import-tip {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.9;
  margin: 0 0 12px;
}

.import-tip code {
  background: #f2f1ed;
  padding: 1.5px 6px;
  border-radius: 4px;
  font-size: 12px;
  margin: 0 2px;
  color: var(--ink);
}

.import-textarea {
  width: 100%;
  padding: 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: #fdfcfb;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}

.import-textarea:focus {
  border-color: var(--gold);
  background: #fff;
}

.import-preview {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-2);
}

.import-preview table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}

.import-preview th,
.import-preview td {
  border: 1px solid var(--line);
  padding: 5px 8px;
  text-align: left;
}

.import-preview th {
  background: #f6f5f2;
  font-weight: 500;
  color: var(--text-2);
}

.lock-screen {
  max-width: 460px;
  margin: 70px auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.lock-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-title {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 7px;
  letter-spacing: 1px;
}

.lock-desc {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.75;
}

@media (max-width: 760px) {
  .admin-bar {
    top: 56px;
  }

  .admin-bar-inner {
    padding: 9px 14px;
    flex-wrap: wrap;
    gap: 9px;
  }

  .admin-bar .search-box {
    max-width: none;
    flex-basis: 100%;
    order: 2;
  }

  .admin-stat {
    order: 1;
  }

  .admin-bar-actions {
    order: 1;
    margin-left: auto;
  }

  .admin-wrap {
    padding: 16px 14px 50px;
  }

  .seat-grid {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 8px;
  }

  .seat-grid.solo {
    grid-template-columns: 1fr;
  }

  .seat {
    padding: 10px 7px 9px;
  }

  .seat-avatar {
    width: 46px;
    height: 46px;
  }

  .seat-name {
    font-size: 12.5px;
  }

  .seat-company {
    font-size: 10px;
    min-height: 28px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-mask {
    padding: 14px;
  }

  .modal-body {
    max-height: 62vh;
  }
}

/* ===== 自有域名下的后台引导 ===== */
.login-hint {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: #fdf6ec;
  border: 1px solid #f0dfc4;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #7a6247;
}
.login-hint a {
  color: #b8791f;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}
.admin-btn.alt {
  margin-top: 10px;
  background: #f6efe4;
  color: #8a6a3f;
  border: 1px solid #e3d2b6;
}
.admin-btn.alt:hover { background: #efe4d3; }
