html,
body {
  height: 100%;
}

body {
  background: #ffffff;
}

/* ====== 密码保护遮罩 ====== */
#passwordOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #1a1a2e;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-box {
  background: #16213e;
  border: 2px solid #e94560;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 0 40px rgba(233,69,96,0.3);
}
.password-icon {
  font-size: 48px;
  margin-bottom: 10px;
}
.password-box h2 {
  color: #e94560;
  margin-bottom: 8px;
  font-size: 20px;
}
.password-box p {
  color: #aaa;
  margin-bottom: 20px;
  font-size: 14px;
}
.password-box input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #e94560;
  border-radius: 6px;
  background: #0f3460;
  color: #fff;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 12px;
}
.password-box input::placeholder { color: #666; }
.password-box input:focus { border-color: #e94560; box-shadow: 0 0 8px rgba(233,69,96,0.4); }
.password-box button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}
.password-box button:hover { background: #d63851; }
.password-error {
  color: #e94560;
  font-size: 13px;
  margin-top: 10px;
  min-height: 20px;
}

/* ====== 首页说明（未加载文件时） ====== */
.instructions {
  color: #5d1313;
  width: 500px;
  text-align: center;
  line-height: 25px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
}

.instructions input {
  display: inline-block;
  max-width: 95px;
}

/* ====== 左侧导航栏 ====== */
.sidebar {
  background: #2c3e50;
  min-height: calc(100vh - 20px);
  border-radius: 6px;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  color: #ecf0f1;
  font-size: 16px;
  font-weight: bold;
  padding: 15px 15px 10px;
  border-bottom: 1px solid #3d566e;
  text-align: center;
}

.sidebar-header small {
  font-weight: normal;
  font-size: 11px;
  color: #95a5a6;
}

.sidebar .nav-pills > li {
  margin: 0;
}
.sidebar .nav-pills > li > a {
  border-radius: 0;
  color: #bdc3c7;
  padding: 10px 15px;
  font-size: 13px;
  border-bottom: 1px solid #34495e;
  transition: all 0.15s;
}
.sidebar .nav-pills > li > a:hover {
  background: #34495e;
  color: #fff;
}
.sidebar .nav-pills > li.active > a,
.sidebar .nav-pills > li.active > a:hover,
.sidebar .nav-pills > li.active > a:focus {
  background: #467bb7;
  color: #fff;
}
.sidebar .nav-pills .badge {
  float: right;
  background: #72beb2;
}

/* 侧边栏底部固定区 */
.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid #3d566e;
}
.sidebar-footer .btn {
  margin-bottom: 8px;
}
.bg-color-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #bdc3c7;
  font-size: 12px;
}
.bg-color-row #bgColorPicker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 3px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.bg-color-row #bgColorPicker:hover {
  transform: scale(1.15);
}

/* ====== 右侧内容区 ====== */
.main-editor {
  padding: 10px;
}
.content-area {
  padding-left: 20px !important;
}

.content-area .panel {
  border: 1px solid #467bb7;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.content-area .panel-heading {
  background: #467bb7;
  color: #fff;
  font-weight: bold;
  font-size: 14px;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
}
.content-area .panel-heading .badge {
  background: #fff;
  color: #467bb7;
  margin-left: 6px;
}
.content-area .panel-body {
  padding: 15px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

/* 居民列表列 */
.dweller-list-col {
  padding-right: 0 !important;
  border-right: 1px solid #e0e0e0;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
}
.dweller-detail-col {
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 15px !important;
}
.dweller-list {
  border-radius: 0;
  margin-bottom: 0;
}
.dweller-list .list-group-item {
  border-left: none;
  border-right: none;
  border-radius: 0 !important;
  cursor: pointer;
  font-size: 13px;
}
.dweller-list .list-group-item:first-child {
  border-top: none;
}

/* ====== SPECIAL 属性条 ====== */
.stat {
  width: 14.285714286%;
}
.stat label {
  width: 100%;
  text-align: center;
}
.stat:first-child {
  display: none;
}
.stat input.form-control {
  padding: 5px;
  text-align: center;
}
.stat .bar {
  width: 15px;
  height: 65px;
  border: 1px solid #ccc;
  position: relative;
  margin: 0 auto 10px;
}
.stat .bar::after {
  content: '';
  display: block;
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 50%;
  background-color: #72beb2;
}
.stat .bar.value0::after  { height: 0%; }
.stat .bar.value1::after  { height: 10%; }
.stat .bar.value2::after  { height: 20%; }
.stat .bar.value3::after  { height: 30%; }
.stat .bar.value4::after  { height: 40%; }
.stat .bar.value5::after  { height: 50%; }
.stat .bar.value6::after  { height: 60%; }
.stat .bar.value7::after  { height: 70%; }
.stat .bar.value8::after  { height: 80%; }
.stat .bar.value9::after  { height: 90%; }
.stat .bar.value10::after { height: 100%; }

/* ====== Bootstrap 覆盖 ====== */
.list-group-item.active,
.list-group-item.active:focus,
.list-group-item.active:hover {
  background-color: #72beb2;
  border-color: #72beb2;
}
a.list-group-item, a.list-group-item, button.list-group-item, button.list-group-item {
  background-color: #fff;
}
.btn-primary {
  background-color: #467bb7;
  border-color: #567997;
}
.back_button {
  display: none;
}

/* ====== 预设 ====== */
.presets {
  margin-top: 30px;
  margin-bottom: 10px;
  height: 370px;
  width: 100%;
  border: 4px solid #467bb7;
  border-radius: 10px;
  overflow: hidden;
  box-sizing: border-box;
  background: #fff;
  position: relative;
}

/* ====== 移动端响应 ====== */
@media (max-width: 768px) {
  body {
    background: #ffffff;
  }
  .instructions {
    width: 90%;
  }
  .sidebar {
    min-height: auto;
    border-radius: 0;
  }
  .sidebar .nav-pills > li {
    display: inline-block;
  }
  .sidebar .nav-pills > li > a {
    font-size: 12px;
    padding: 8px 10px;
  }
  .sidebar-footer {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .sidebar-footer .btn {
    margin-bottom: 0;
    flex: 1;
  }
  .content-area {
    padding-left: 15px !important;
  }
  .content-area .panel-body {
    max-height: none;
  }
  .dweller-list-col,
  .dweller-detail-col {
    max-height: none;
    border-right: none;
  }
  .stat {
    width: 25%;
    float: left;
  }
}
