:root {
  --page-bg: #ededed;
  --panel-bg: #ffffff;
  --panel-line: #d8d8d8;
  --text: #2f2f2f;
  --muted: #808080;
  --soft: #f5f5f5;
  --green: #64bd80;
  --green-dark: #42a565;
  --blue: #5b9fd7;
  --red: #e46f67;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, "Noto Sans TC", "PingFang TC", sans-serif;
  letter-spacing: 0;
}

svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hide {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(390px, 100%);
  background: #fff;
  border: 1px solid var(--panel-line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  padding: 28px 26px 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.login-mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
}

.login-mark svg {
  width: 28px;
  height: 28px;
}

.login-brand h1,
.login-brand p {
  margin: 0;
}

.login-brand h1 {
  font-size: 23px;
}

.login-brand p {
  margin-top: 2px;
  color: #9a9a9a;
  font-size: 18px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #666;
}

.login-form input {
  min-height: 42px;
}

.login-submit {
  min-height: 42px;
  border: 0;
  border-radius: 3px;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

.login-error {
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.app-view {
  min-height: 100vh;
}

.topbar {
  width: min(100%, 940px);
  min-height: 58px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.title {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  padding: 14px 0;
}

.title strong {
  font-size: 18px;
  font-weight: 700;
}

.title span {
  color: #9a9a9a;
  font-size: 18px;
}

.user-menu {
  display: flex;
  gap: 8px;
}

.user-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #d3d3d3;
  background: #fff;
  border-radius: 50%;
  color: #666;
  display: grid;
  place-items: center;
  font-size: 17px;
}

.user-btn.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.container {
  width: min(100%, 940px);
  margin: 0 auto;
  padding: 0 12px 40px;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(340px, 1fr);
  gap: 18px;
  align-items: start;
}

.part-num {
  background: var(--panel-bg);
  border: 1px solid var(--panel-line);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.door-nav {
  padding: 14px 16px;
  border-bottom: 1px solid var(--panel-line);
}

.door-nav:last-child {
  border-bottom: 0;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding-top: 24px;
  padding-bottom: 18px;
}

.door-fig-num {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f7f7f7 0%, #e7e7e7 100%);
  border: 1px solid #d1d1d1;
  display: grid;
  place-items: center;
}

.door-fig {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #fff;
  border: 8px solid var(--green);
  position: relative;
  display: grid;
  place-items: center;
}

.door-fig::before {
  content: "";
  width: 33px;
  height: 28px;
  border: 7px solid var(--green);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  position: absolute;
  top: 16px;
  left: 24px;
  transform: rotate(-14deg);
  transform-origin: bottom right;
}

.door-fig .lock-body {
  width: 38px;
  height: 30px;
  background: var(--green);
  border-radius: 5px;
  position: absolute;
  top: 42px;
}

.door-fig.locking {
  border-color: var(--red);
}

.door-fig.locking::before {
  border-color: var(--red);
  transform: rotate(0);
}

.door-fig.locking .lock-body {
  background: var(--red);
}

.door-name-num-edit .normal,
.door-name-num-edit .editing {
  display: flex;
  align-items: center;
  gap: 6px;
}

#door-name {
  min-width: 0;
  max-width: 260px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  word-break: break-word;
}

.edit-btn,
.list-btn,
.qrcode-btn,
.state-btn,
.square-btn,
.small-square,
.page-btn,
.icon-btn {
  border: 1px solid #cfcfcf;
  color: #555;
  background: #fff;
  min-width: 32px;
  height: 30px;
  border-radius: 3px;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.edit-btn {
  min-width: 26px;
  height: 26px;
  border: 0;
  color: #777;
  background: transparent;
}

.setting-list {
  padding: 0;
}

.door-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e6e6e6;
  padding: 10px 14px;
}

.door-row:last-child {
  border-bottom: 0;
}

.door-row > span:first-child {
  color: #666;
  white-space: nowrap;
}

.door-row > div {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.control-row {
  gap: 10px;
}

.control-row .control-text {
  flex: 1 1 auto;
}

.door-state-num {
  color: var(--green-dark);
  font-weight: 700;
  white-space: nowrap;
}

.door-state-num.locked {
  color: var(--red);
}

.door-btn-num {
  border: 0;
  background: var(--green);
  color: #fff;
  min-height: 32px;
  min-width: 92px;
  border-radius: 3px;
  padding: 0 12px;
}

.door-btn-num:active,
.control-btn:active,
.action-btn:active {
  transform: translateY(1px);
}

.state-btn {
  min-width: 56px;
  padding: 0 8px;
  color: var(--green-dark);
}

.qrcode-btn {
  font-size: 19px;
}

.editable-row span + div span {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switchNav {
  padding: 13px 14px 8px;
}

.segmented {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--green);
  border-radius: 3px;
  overflow: hidden;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--green);
  background: #fff;
  color: var(--green-dark);
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--green);
  color: #fff;
  font-weight: 700;
}

.segmented.small {
  grid-template-columns: repeat(2, 1fr);
}

.passwordListContainer {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 3px;
  overflow: hidden;
}

.list-head-container,
.password-row {
  display: grid;
  grid-template-columns: 78px 1fr 72px;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.list-head-container {
  background: #f3f3f3;
  color: #666;
  font-size: 13px;
  font-weight: 700;
}

.password-row {
  border-top: 1px solid #e7e7e7;
  background: #fff;
}

.password-row button {
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  padding: 0;
}

.password-code {
  font-weight: 700;
  font-size: 17px;
}

.password-note {
  min-width: 0;
}

.password-note strong,
.password-note span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.password-note span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 12px;
  padding: 0 9px;
  background: #eef8f1;
  color: var(--green-dark);
  font-size: 12px;
  white-space: nowrap;
}

.pill.expiring {
  background: #fff3dc;
  color: #b7791f;
}

.pill.off {
  background: #f2f2f2;
  color: #888;
}

.footer-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.row-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  min-height: 34px;
  border: 1px solid #cfcfcf;
  background: #fff;
  color: #555;
  border-radius: 3px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.action-btn.slim {
  min-height: 30px;
  padding: 0 9px;
}

.page-btn.muted {
  opacity: 0.45;
}

.search-bar {
  border-top: 1px solid var(--panel-line);
  padding: 10px 14px;
  display: flex;
  gap: 8px;
}

.search-bar input {
  flex: 1;
}

input {
  min-height: 34px;
  border: 1px solid #cacaca;
  border-radius: 3px;
  padding: 0 10px;
  outline: 0;
  background: #fff;
  min-width: 0;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(100, 189, 128, 0.18);
}

.table-title,
.modal-title {
  text-align: center;
  font-weight: 700;
}

.settingContainer {
  width: 100%;
  display: grid;
  gap: 12px;
}

.settingRow {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settingRow input[type="text"],
.settingRow input:not([type]) {
  flex: 1;
}

.switch-pill {
  border: 1px solid #d2d2d2;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  color: #666;
}

.settingCodeBlock {
  padding: 0;
}

.scrollContainer {
  padding: 14px 16px;
  display: grid;
  gap: 12px;
  max-height: 420px;
  overflow: auto;
}

.checkboxContainer {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #555;
}

.checkboxContainer input {
  min-height: auto;
  width: 17px;
  height: 17px;
}

.reserve-list {
  border-left: 3px solid var(--green);
  background: #f8fbf8;
  padding: 8px 10px;
  color: #666;
  display: grid;
  gap: 5px;
}

.detail-text {
  color: var(--muted);
  font-size: 13px;
}

.times-row {
  display: grid;
  grid-template-columns: 1fr 70px 24px;
  align-items: center;
  gap: 8px;
  color: #666;
}

.control-btn-group,
.button-row {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--panel-line);
}

.control-btn {
  min-width: 92px;
  min-height: 36px;
  border-radius: 3px;
  border: 1px solid #cfcfcf;
  background: #fff;
  color: #555;
}

.control-btn.primary {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.control-btn.secondary {
  background: #f7f7f7;
}

.mask {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.26);
  display: grid;
  place-items: start center;
  padding: 72px 12px 20px;
  overflow: auto;
}

.part-block {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #d1d1d1;
  border-radius: 3px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.part-block.compact {
  width: min(390px, 100%);
}

.modal-nav,
.modal-footer {
  min-height: 54px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--panel-line);
}

.modal-footer {
  border-top: 1px solid var(--panel-line);
  border-bottom: 0;
}

.date-picker,
.page-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.date-label {
  min-height: 31px;
  border: 1px solid #d0d0d0;
  background: #fff;
  border-radius: 3px;
  padding: 0 10px;
}

.record-list {
  max-height: 430px;
  overflow: auto;
}

.record-item {
  display: grid;
  grid-template-columns: 68px 1fr 62px;
  gap: 8px;
  align-items: center;
  padding: 11px 13px;
  border-bottom: 1px solid #ececec;
}

.record-time {
  font-weight: 700;
}

.record-main strong,
.record-main span {
  display: block;
}

.record-main span {
  color: var(--muted);
  font-size: 12px;
}

.record-badge {
  justify-self: end;
}

.step-btn {
  width: 42px;
  height: 38px;
  border: 1px solid #cfcfcf;
  background: #fff;
  color: #555;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.part-title {
  margin: 0;
  padding: 18px 16px;
  text-align: center;
  font-weight: 700;
  border-bottom: 1px solid var(--panel-line);
}

.time-row,
.field-line,
.info-row {
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #e7e7e7;
}

.time-row em {
  font-style: normal;
  color: var(--muted);
}

.time-row {
  grid-template-columns: 86px 1fr auto;
}

.field-line span,
.time-row span,
.info-row span:first-child {
  color: #666;
}

.qrcode-block {
  padding-top: 20px;
}

.fake-qr {
  width: 236px;
  height: 236px;
  margin: 0 auto 12px;
  background: #fff;
  border: 10px solid #fff;
  box-shadow: 0 0 0 1px #ddd;
  image-rendering: pixelated;
}

.fake-qr span {
  display: block;
}

.qr-caption {
  padding: 0 18px 14px;
  color: #666;
  text-align: center;
  word-break: break-all;
  font-size: 12px;
}

.row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-list {
  padding: 12px 16px;
  display: grid;
  gap: 8px;
}

.backup-card {
  min-height: 40px;
  border: 1px solid #dedede;
  border-radius: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.backup-card button {
  border: 0;
  background: transparent;
  color: var(--red);
}

.new-card-form {
  padding: 0 16px 14px;
  display: grid;
  gap: 9px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 40;
  transform: translateX(-50%);
  min-width: 170px;
  min-height: 38px;
  background: rgba(31, 31, 31, 0.9);
  color: #fff;
  border-radius: 3px;
  display: grid;
  place-items: center;
  padding: 0 16px;
}

.copydiv {
  width: min(100%, 940px);
  margin: 16px auto 24px;
  text-align: center;
  color: #8a8a8a;
  font-size: 12px;
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 12px;
  }

  .user-menu {
    gap: 5px;
  }

  .user-btn {
    width: 32px;
    height: 32px;
  }

  .container {
    max-width: 430px;
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 24px;
  }

  .door-nav {
    padding: 12px 13px;
  }

  .setting-list {
    padding: 0;
  }

  .footer-tools {
    align-items: stretch;
  }

  .row-nav {
    flex-wrap: nowrap;
  }

  .pager {
    justify-content: flex-end;
  }

  .list-head-container,
  .password-row {
    grid-template-columns: 72px 1fr 62px;
    padding-left: 9px;
    padding-right: 9px;
  }
}

@media (max-width: 374px) {
  .door-row {
    padding-left: 10px;
    padding-right: 10px;
  }

  .control-row {
    flex-wrap: wrap;
  }

  .door-btn-num {
    flex: 1 0 100%;
  }

  .footer-tools {
    flex-direction: column;
    gap: 10px;
  }
}
