html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 14px/1.55 "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #2a2724;
  background: #efeae2;
}
* { box-sizing: border-box; }
a { color: #8a3d1c; }
button, input { font: inherit; }
button, a, input { touch-action: manipulation; }
code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  background: #f3ece3;
  padding: 1px 5px;
  border: 1px solid #e2d6c8;
}

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

.rail {
  background: #2b2a28;
  color: #d7d1c7;
  display: flex;
  flex-direction: column;
  padding: 22px 0 16px;
}
.rail-brand { padding: 0 18px 18px; border-bottom: 1px solid #3d3b38; }
.rail-brand b { display: block; color: #f3ece3; font-size: 18px; letter-spacing: 2px; }
.rail-brand small { color: #9a9388; font-size: 12px; }
.rail nav { padding: 12px 10px; flex: 1; }
.rail nav a {
  display: block;
  color: #cfc8bc;
  text-decoration: none;
  padding: 8px 10px;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
}
.rail nav a:hover { background: #35332f; color: #fff; }
.rail nav a.on { background: #35332f; color: #fff; border-left-color: #c45c26; }
.rail-foot {
  padding: 12px 18px 0;
  border-top: 1px solid #3d3b38;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #9a9388;
}
.rail-foot a { color: #cfc8bc; text-decoration: none; }
.rail-foot a:hover { color: #fff; }

.stage { padding: 22px 28px 48px; min-width: 0; }
.mast {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid #ddd4c8;
  padding-bottom: 14px;
}
.mast h1 { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.mast p { margin: 0; color: #6f675d; font-size: 13px; }

.nums {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.nums div {
  background: #fbf8f3;
  border: 1px solid #ddd4c8;
  padding: 10px 12px;
}
.nums i { display: block; font-style: normal; color: #7a7268; font-size: 12px; }
.nums b { font-size: 18px; }

.find {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.find input[type="search"] {
  width: min(320px, 100%);
  height: 34px;
  border: 1px solid #cfc3b4;
  background: #fff;
  padding: 0 10px;
}
.find button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #8a3d1c;
  background: #8a3d1c;
  color: #fff;
  cursor: pointer;
}
.find a { font-size: 13px; }

.tbl-wrap { overflow-x: auto; border: 1px solid #ddd4c8; background: #fbf8f3; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid #eee4d8;
  vertical-align: middle;
}
.tbl th {
  font-size: 12px;
  color: #6f675d;
  font-weight: 700;
  background: #f3ece3;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #f6f0e8; }
.tbl .chk { width: 28px; }
.tbl .mute, .mute { color: #7a7268; font-size: 12px; }

.who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.who em {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  background: #2b2a28; color: #f3ece3;
  font-style: normal; font-size: 13px; font-weight: 700;
}
.who b { display: block; font-size: 13px; }
.who small { color: #7a7268; font-size: 12px; }

.tag {
  display: inline-block;
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid #c9d7c8;
  background: #eef4ee;
  color: #2f6b4f;
}
.tag.warn {
  border-color: #e2c4a4;
  background: #f8efe4;
  color: #8a3d1c;
}

.ops { white-space: nowrap; }
.ops a, .ops button {
  display: inline-block;
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: #8a3d1c;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}
.ops a:first-child, .ops button:first-child { margin-left: 0; }
.ops .danger { color: #a33b32; }
.linkish {
  margin-left: 6px;
  border: 0;
  background: none;
  color: #8a3d1c;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.batch {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.ghost { display: none; }

.blank {
  padding: 28px 12px;
  text-align: center;
  color: #6f675d;
  background: #fbf8f3;
  border: 1px dashed #d5c9ba;
}

.sheet {
  max-width: 520px;
  background: #fbf8f3;
  border: 1px solid #ddd4c8;
  padding: 22px 22px 18px;
}
.edit label { display: block; font-size: 13px; font-weight: 700; margin: 0 0 5px; }
.edit input[type="text"], .edit input[type="password"],
.wipe input[type="text"], .gate input[type="password"] {
  width: 100%;
  height: 36px;
  border: 1px solid #cfc3b4;
  background: #fff;
  padding: 0 10px;
  margin-bottom: 4px;
}
.edit input[readonly] { background: #f3ece3; color: #6f675d; }
.note { margin: 0 0 14px; color: #7a7268; font-size: 12px; }
.form-ops { display: flex; gap: 8px; margin-top: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
}
.btn-go { background: #c45c26; border-color: #c45c26; color: #fff; }
.btn-go:hover { background: #a84c1e; color: #fff; }
.btn-plain { background: #fff; border-color: #cfc3b4; color: #2a2724; }
.btn-warn { background: #a33b32; border-color: #a33b32; color: #fff; }

.flash {
  margin: 0 0 14px;
  padding: 9px 12px;
  font-size: 13px;
  border: 1px solid transparent;
}
.flash.ok { background: #e7f0ea; border-color: #c9d7c8; color: #2f6b4f; }
.flash.bad { background: #f8eaea; border-color: #e4c7c4; color: #a33b32; }

.tools {
  display: grid;
  gap: 14px;
  max-width: 640px;
}
.tools article {
  background: #fbf8f3;
  border: 1px solid #ddd4c8;
  padding: 16px 18px 18px;
}
.tools h2 { margin: 0 0 6px; font-size: 16px; }
.tools p { margin: 0 0 12px; color: #6f675d; font-size: 13px; }
.danger-box { border-color: #e4c7c4; background: #fbf6f4; }
.wipe label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.wipe input { max-width: 220px; margin-right: 8px; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #efeae2;
}
.gate {
  display: grid;
  grid-template-columns: 10px 1fr;
  width: min(420px, calc(100% - 32px));
  background: #fbf8f3;
  border: 1px solid #ddd4c8;
}
.gate-side { background: #c45c26; }
.gate-main { padding: 28px 26px 24px; }
.gate-kicker {
  margin: 0 0 6px;
  letter-spacing: 3px;
  font-size: 12px;
  color: #c45c26;
  font-weight: 700;
}
.gate h1 { margin: 0 0 16px; font-size: 22px; }
.gate .btn { margin-top: 12px; width: 100%; height: 38px; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand foot"
      "nav nav";
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 8px 10px 0;
    padding-top: max(8px, env(safe-area-inset-top));
    gap: 0;
  }
  .rail-brand { grid-area: brand; border: 0; padding: 6px 4px; }
  .rail-brand small { display: none; }
  .rail nav {
    grid-area: nav;
    display: flex;
    gap: 0;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .rail nav a {
    flex: none;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 10px 12px;
    margin: 0;
    white-space: nowrap;
  }
  .rail nav a.on { border-bottom-color: #c45c26; }
  .rail-foot {
    grid-area: foot;
    border: 0;
    padding: 6px 4px;
    margin: 0;
    align-items: center;
  }
  .rail-foot span { display: none; }
  .rail-foot a { padding: 8px 6px; }

  .stage {
    padding: 14px 12px calc(28px + env(safe-area-inset-bottom));
  }
  .mast {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .mast .btn-go { display: none; }
  .mast h1 { font-size: 18px; }
  .nums { grid-template-columns: 1fr 1fr; }
  .nums b { font-size: 16px; word-break: break-all; }

  .find {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }
  .find input[type="search"] { width: 100%; height: 44px; font-size: 16px; }
  .find button { height: 44px; min-width: 64px; }

  input[type="text"],
  input[type="password"],
  input[type="search"] { font-size: 16px; }
  .edit input[type="text"],
  .edit input[type="password"],
  .wipe input[type="text"],
  .gate input[type="password"] { height: 44px; }

  .sheet { padding: 16px 14px 14px; }
  .form-ops { flex-direction: column; }
  .form-ops .btn { width: 100%; height: 44px; }

  .tools { max-width: none; }
  .tools article { padding: 14px; }
  .tools .btn { width: 100%; height: 44px; }
  .wipe input { max-width: none; width: 100%; margin: 0 0 8px; display: block; }
  .batch { flex-wrap: wrap; }
  .batch .btn { width: 100%; height: 44px; }

  .login-body {
    padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
    place-items: center stretch;
  }
  .gate { width: 100%; }
  .gate-main { padding: 22px 16px 18px; }
  .gate .btn { height: 44px; }
}

@media (max-width: 720px) {
  .tbl-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .tbl, .tbl tbody { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    grid-template-areas:
      "chk name status"
      "chk path path"
      "chk time time"
      "chk ops ops";
    gap: 6px 10px;
    background: #fbf8f3;
    border: 1px solid #ddd4c8;
    padding: 12px;
    margin-bottom: 8px;
  }
  .tbl tr:hover td { background: transparent; }
  .tbl td {
    border: 0;
    padding: 0;
    background: transparent;
  }
  .tbl .chk { grid-area: chk; padding-top: 4px; }
  .tbl .col-name { grid-area: name; min-width: 0; }
  .tbl .col-path { grid-area: path; }
  .tbl .col-status { grid-area: status; align-self: start; }
  .tbl .col-time { grid-area: time; }
  .tbl .ops {
    grid-area: ops;
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
  }
  .tbl .ops a, .tbl .ops button {
    margin: 0 12px 0 0;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }
  .who b { white-space: normal; word-break: break-all; }
  .col-path code { word-break: break-all; }
}

@media (max-width: 380px) {
  .nums { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rail nav a { padding: 10px 10px; }
}
