:root {
  --paper: #f7f4ec;
  --card: #fffdf8;
  --ink: #2c2c2a;
  --muted: #8a7f6b;
  --line: #e6dcc9;
  --zhu: #a32d2d;
  --zhu-dark: #7e1f1f;
  --gold: #b08a3e;
  --green: #2f7d46;
  --shadow: 0 10px 30px rgba(86, 63, 32, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 6% 2%, rgba(163, 45, 45, 0.06), transparent 34%),
    radial-gradient(circle at 96% 10%, rgba(176, 138, 62, 0.09), transparent 36%),
    var(--paper);
  color: var(--ink);
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "PingFang SC", serif;
  font-size: 14px;
}

body { min-height: 100vh; }

a { color: var(--zhu); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code { font-family: Menlo, monospace; font-size: 11px; }

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }

.seal {
  width: 44px;
  height: 44px;
  border: 2px solid var(--zhu);
  border-radius: 6px;
  color: var(--zhu);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  transform: rotate(-5deg);
  background: rgba(255, 253, 248, 0.9);
}

.brand-name { font-size: 19px; letter-spacing: 4px; font-weight: 600; }
.brand-name span { font-size: 13px; letter-spacing: 2px; color: var(--muted); font-weight: 400; }
.brand-sub { font-size: 10px; letter-spacing: 1.6px; color: var(--muted); margin-top: 2px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  background: var(--card);
}
.status-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #c9b795;
}
.status-pill.ok .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(47, 125, 70, 0.12); }
.status-pill.bad .dot { background: var(--zhu); box-shadow: 0 0 0 3px rgba(163, 45, 45, 0.12); }

.topnav { margin-left: auto; display: flex; gap: 20px; font-size: 12px; }
.topnav a { color: #6e6456; }
.topnav a:hover { color: var(--zhu); }

.layout {
  display: grid;
  grid-template-columns: 300px minmax(430px, 1fr) 350px;
  gap: 22px;
  max-width: 1560px;
  margin: 0 auto;
  padding: 22px 26px 40px;
  align-items: start;
}

.sidebar, .logpanel { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 16px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  letter-spacing: 2px;
  font-weight: 600;
  margin-bottom: 12px;
}
.panel-title span { font-size: 10px; color: var(--muted); letter-spacing: 1px; font-weight: 400; }

.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.account-grid button {
  border: 1px solid var(--line);
  background: #fbf8f0;
  border-radius: 9px;
  padding: 9px 8px;
  text-align: left;
  color: var(--ink);
  transition: 0.15s ease;
}
.account-grid button:hover { border-color: var(--zhu); background: #fdf4f0; }
.account-grid button .a-role { font-size: 10px; color: var(--zhu); letter-spacing: 1px; }
.account-grid button .a-name { font-size: 12px; margin-top: 2px; }
.account-grid button .a-phone { font-size: 9px; color: var(--muted); font-family: Menlo, monospace; }

.ghost-btn {
  width: 100%;
  margin-top: 10px;
  border: 1px dashed #d4c6b1;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px;
  font-size: 11px;
}
.ghost-btn:hover { color: var(--zhu); border-color: var(--zhu); }

.screen-links { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.screen-links button {
  border: 1px solid var(--line);
  background: #fbf8f0;
  border-radius: 8px;
  padding: 8px 6px;
  font-size: 11px;
  color: #5d5142;
}
.screen-links button:hover { border-color: var(--zhu); color: var(--zhu); }

.hint { font-size: 11px; line-height: 1.75; color: var(--muted); margin: 0 0 12px; }

.primary-btn {
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, #a93333, #8e2323);
  color: #fff8e9;
  padding: 11px;
  font-size: 13px;
  letter-spacing: 1px;
  box-shadow: 0 8px 18px rgba(142, 35, 35, 0.2);
}
.primary-btn:disabled { opacity: 0.55; box-shadow: none; cursor: not-allowed; }

.scenario-summary { font-size: 11px; margin-top: 10px; color: var(--muted); min-height: 16px; }
.scenario-summary .ok { color: var(--green); font-weight: 600; }
.scenario-summary .bad { color: var(--zhu); font-weight: 600; }

.step-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 360px; overflow: auto; }
.step-list li {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px dashed #efe6d6;
  font-size: 11px;
  line-height: 1.5;
}
.step-list li:last-child { border-bottom: 0; }
.step-list .mark { width: 15px; flex-shrink: 0; color: #c0b39d; }
.step-list li.running .mark { color: var(--gold); }
.step-list li.ok .mark { color: var(--green); }
.step-list li.bad .mark { color: var(--zhu); }
.step-list .detail { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; word-break: break-all; }

.stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.stage-head {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}
.stage-title { font-size: 17px; letter-spacing: 2px; font-weight: 600; }
.stage-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.stage-actions { display: flex; gap: 8px; }
.mini-link {
  border: 1px solid var(--line);
  background: var(--card);
  color: #6e6456;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 10px;
}
.mini-link:hover { border-color: var(--zhu); color: var(--zhu); }

.phone-wrap { padding: 6px 0 0; }

.phone {
  width: 386px;
  height: 802px;
  background: #1f1b18;
  border-radius: 44px;
  padding: 10px;
  box-shadow:
    0 30px 70px rgba(53, 38, 22, 0.28),
    inset 0 0 0 2px #3a322b;
  position: relative;
  display: flex;
  flex-direction: column;
}

.notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 118px;
  height: 24px;
  background: #1f1b18;
  border-radius: 0 0 16px 16px;
  z-index: 5;
}

.statusbar {
  height: 28px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f7f4ec;
  font-size: 10px;
  letter-spacing: 0.5px;
  background: #f7f4ec;
  color: #2c2c2a;
  border-radius: 34px 34px 0 0;
  padding-top: 8px;
}
.statusbar .sb-right { font-size: 8px; }

.phonenav {
  height: 40px;
  background: #f7f4ec;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(230, 220, 201, 0.7);
}
.phonenav-title { font-size: 13px; font-weight: 600; letter-spacing: 2px; }
.navicon {
  width: 26px; height: 26px;
  border: 0; background: transparent;
  color: #5d5142; font-size: 20px; line-height: 1;
  display: grid; place-items: center;
}
.navicon.muted { color: #b3a894; font-size: 15px; }

.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 4%, rgba(163, 45, 45, 0.05), transparent 36%),
    #f7f4ec;
  padding: 14px 14px 22px;
  scrollbar-width: thin;
}
.screen::-webkit-scrollbar { width: 4px; }
.screen::-webkit-scrollbar-thumb { background: #d8cbb4; border-radius: 3px; }

.tabbar {
  height: 54px;
  background: #fffdf8;
  border-radius: 0 0 34px 34px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #efe6d6;
}
.tab {
  border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 9px; color: #8a7f6b;
}
.tabglyph {
  width: 20px; height: 20px; border-radius: 5px;
  display: grid; place-items: center; font-size: 10px;
  border: 1px solid #d8cbb4; color: #8a7f6b;
}
.tab.active { color: var(--zhu); }
.tab.active .tabglyph { color: var(--zhu); border-color: var(--zhu); background: rgba(163, 45, 45, 0.06); }

.stage-foot {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  color: var(--muted);
  padding: 0 6px;
  flex-wrap: wrap;
}

.logpanel {
  background: #221e1a;
  border-radius: 14px;
  padding: 14px;
  color: #d8cbb4;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 120px);
}
.logpanel .panel-title { color: #f1e6d3; }
.logpanel .mini-link { background: transparent; color: #b9a98f; border-color: #443a30; }
.log-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.log-list {
  overflow-y: auto;
  max-height: calc(100vh - 300px);
  font-family: Menlo, monospace;
  font-size: 10px;
  line-height: 1.65;
}
.log-item { padding: 6px 0; border-bottom: 1px dashed #3a332c; word-break: break-all; }
.log-item .l-top { display: flex; justify-content: space-between; gap: 6px; }
.log-item .l-method { color: #e0c48b; }
.log-item .l-status.ok { color: #8fc99f; }
.log-item .l-status.bad { color: #e58f86; }
.log-item .l-path { color: #cfc0a8; }
.log-item .l-time { color: #7f7263; font-size: 9px; }
.log-foot { margin-top: 10px; border-top: 1px solid #3a332c; padding-top: 8px; font-size: 9px; color: #9c8c75; line-height: 1.8; }
.log-foot a { color: #e0c48b; }

/* ------------------------------ phone content ------------------------------ */

.p-hero { padding: 10px 4px 8px; }
.p-eyebrow { font-size: 9px; letter-spacing: 3px; color: var(--muted); }
.p-title { font-size: 25px; line-height: 1.35; letter-spacing: 3px; font-weight: 600; margin-top: 5px; }
.p-title .zhu { color: var(--zhu); }
.p-sub { font-size: 11px; color: #7b7060; line-height: 1.7; margin-top: 6px; }
.p-honor {
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: linear-gradient(100deg, #6e2020, #8f2b2b 60%, #7a2424);
  color: #f0dfb8;
  font-size: 9px;
  letter-spacing: 0.5px;
}

.p-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  margin-top: 11px;
  box-shadow: 0 5px 16px rgba(86, 63, 32, 0.04);
}
.p-card-title { font-size: 14px; font-weight: 600; letter-spacing: 1px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.p-muted { color: var(--muted); font-size: 10px; line-height: 1.7; }
.p-small { font-size: 10px; }
.p-row { display: flex; align-items: center; gap: 8px; }
.p-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p-seal {
  width: 42px; height: 42px;
  border: 1.5px solid var(--zhu);
  color: var(--zhu);
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 17px;
  transform: rotate(-4deg);
  flex-shrink: 0;
  background: #fdf7ed;
}
.p-seal.small { width: 32px; height: 32px; font-size: 13px; border-width: 1px; }
.p-seal.large { width: 58px; height: 58px; font-size: 20px; }

.p-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  background: #f1eadb;
  color: #7a6e5b;
  font-size: 9px;
  white-space: nowrap;
}
.p-tag.warn { background: #fbefdc; color: #9a6a1c; }
.p-tag.ok { background: #e8f2e9; color: var(--green); }
.p-tag.danger { background: #fbe8e5; color: var(--zhu); }
.p-tag.info { background: #e9eef4; color: #3d5a76; }
.p-tag.gold { background: #f6edda; color: #9a7429; }

.p-btn {
  border: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, #a93333, #8e2323);
  color: #fff8e9;
  padding: 9px 12px;
  font-size: 11px;
  letter-spacing: 1px;
  width: 100%;
}
.p-btn.ghost { background: transparent; border: 1px solid #cbbda5; color: #5d5142; }
.p-btn.soft { background: #f5e9e2; color: #8e2323; }
.p-btn.sm { padding: 6px 9px; font-size: 10px; }
.p-btn:disabled { opacity: 0.5; }
.p-btn-row { display: flex; gap: 7px; margin-top: 10px; }

.p-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.p-quick-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 11px;
}
.p-quick-icon {
  width: 30px; height: 30px; border-radius: 6px;
  background: #f6eee0; color: var(--zhu);
  display: grid; place-items: center; font-size: 11px; flex-shrink: 0;
}

.p-role-action {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border: 1px solid #eadfc9;
  border-radius: 8px;
  background: #fbf5e9;
  margin-top: 7px;
  font-size: 11px;
}
.p-role-action .t { color: var(--zhu); margin-right: 4px; }

.p-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.p-stat-num { font-size: 20px; color: var(--zhu); font-weight: 600; line-height: 1.2; }
.p-stat-label { font-size: 9px; color: var(--muted); }

.p-steps { display: flex; justify-content: space-between; gap: 3px; margin-top: 12px; }
.p-step { flex: 1; text-align: center; min-width: 0; }
.p-step-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid #d8cbb4; color: #b3a894;
  font-size: 9px; display: grid; place-items: center;
  margin: 0 auto 3px; background: #fbf8f0;
}
.p-step.done .p-step-dot { background: var(--zhu); border-color: var(--zhu); color: #fff8e9; }
.p-step.active .p-step-dot { border-color: var(--zhu); color: var(--zhu); }
.p-step span { font-size: 8px; color: #9b9080; line-height: 1.2; display: block; }

.p-field { margin-top: 10px; }
.p-label { font-size: 10px; color: #5d5142; margin-bottom: 4px; }
.p-input, .p-textarea, .p-select {
  width: 100%;
  border: 1px solid #e3d8c4;
  border-radius: 6px;
  background: #fbf8f0;
  padding: 8px 9px;
  font-family: inherit;
  font-size: 11px;
  color: var(--ink);
}
.p-textarea { min-height: 70px; resize: vertical; }
.p-input:focus, .p-textarea:focus, .p-select:focus { outline: 1px solid rgba(163, 45, 45, 0.35); }

.p-list-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0;
  border-bottom: 1px dashed #eee4d2;
  font-size: 11px;
}
.p-list-row:last-child { border-bottom: 0; }

.p-chips { display: flex; gap: 5px; overflow-x: auto; padding: 2px 0 4px; }
.p-chip {
  border: 1px solid transparent;
  background: #f4eee1;
  color: #6e6456;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 9px;
  white-space: nowrap;
}
.p-chip.active { background: var(--zhu); color: #fff8e9; }

.p-cert {
  margin-top: 10px;
  padding: 16px 13px;
  background: #fffdf6;
  border: 1px solid #d9c7a5;
  border-radius: 4px;
  box-shadow: inset 0 0 0 4px #fffdf6, inset 0 0 0 5px #eadcc1;
  position: relative;
}
.p-cert-title { text-align: center; font-size: 17px; letter-spacing: 7px; color: var(--zhu-dark); font-weight: 600; }
.p-cert-sub { text-align: center; font-size: 8px; letter-spacing: 2px; color: #a3906b; margin-top: 2px; }
.p-cert-body { font-size: 10.5px; line-height: 1.8; color: #4a4034; margin-top: 10px; }
.p-cert-row { display: flex; gap: 6px; margin-top: 3px; }
.p-cert-row .k { width: 54px; color: #9a8a70; flex-shrink: 0; }
.p-cert-row .v { flex: 1; word-break: break-all; }
.p-cert-hash { font-family: Menlo, monospace; font-size: 8px; color: #a3906b; word-break: break-all; line-height: 1.5; }

.p-lock {
  position: relative;
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
  background: #fbf7ee;
  border: 1px dashed #d9c9ab;
  padding: 14px;
}
.p-lock .blurred { filter: blur(4px); opacity: 0.55; font-size: 10px; line-height: 1.8; }
.p-lock .overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  background: linear-gradient(180deg, rgba(251,247,238,0.25), rgba(251,247,238,0.94));
  text-align: center;
  font-size: 10px;
}

.p-empty { text-align: center; padding: 28px 10px; color: var(--muted); font-size: 10px; line-height: 1.8; }
.p-empty .ring {
  width: 44px; height: 44px; border: 1px dashed #cbbda5; border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto 8px; color: #c0b39d; font-size: 12px;
}

.p-notice { margin-top: 10px; padding: 9px 11px; border-radius: 6px; background: #f6f0e3; color: #776a56; font-size: 9.5px; line-height: 1.7; }
.p-notice.red { background: #fbeceb; color: #8e2b2b; }

.p-footer { margin-top: 18px; text-align: center; font-size: 8px; color: #a89b86; line-height: 1.9; letter-spacing: 0.5px; }
.p-divider { height: 1px; background: #ece3d3; margin: 9px 0; }

.p-avatar {
  width: 34px; height: 34px; border-radius: 7px;
  background: #efe4d0; color: var(--zhu);
  display: grid; place-items: center; font-size: 15px; flex-shrink: 0;
  border: 1px solid #e3d8c4;
}

.p-timeline { padding-left: 12px; position: relative; margin-top: 6px; }
.p-timeline::before { content: ""; position: absolute; left: 3px; top: 4px; bottom: 4px; width: 1px; background: #e3d8c4; }
.p-tl-item { position: relative; padding-bottom: 9px; font-size: 10px; }
.p-tl-item::before { content: ""; position: absolute; left: -12px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--zhu); }
.p-tl-desc { font-size: 8.5px; color: var(--muted); }

.p-quota { height: 4px; border-radius: 2px; background: #efe6d5; margin-top: 7px; overflow: hidden; }
.p-quota i { display: block; height: 100%; background: linear-gradient(90deg, #b64545, #a32d2d); }

.p-link { color: var(--zhu); font-size: 10px; }
.p-right { text-align: right; }
.p-mt4 { margin-top: 4px; }
.p-mt8 { margin-top: 8px; }
.p-mt12 { margin-top: 12px; }
.p-bold { font-weight: 600; }
.p-green { color: var(--green); }
.p-zhu { color: var(--zhu); }
.p-wrap { display: flex; flex-wrap: wrap; gap: 4px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: #2c2c2a;
  color: #f7f4ec;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12px;
  opacity: 0;
  transition: 0.2s ease;
  pointer-events: none;
  z-index: 100;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: #7e1f1f; }

@media (max-width: 1320px) {
  .layout { grid-template-columns: 270px minmax(410px, 1fr) 300px; gap: 16px; }
  .phone { width: 366px; height: 780px; }
}

@media (max-width: 1080px) {
  .layout { grid-template-columns: 280px 1fr; }
  .logpanel { grid-column: 1 / -1; position: static; max-height: 300px; }
  .log-list { max-height: 160px; }
}

@media (max-width: 760px) {
  .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topnav { margin-left: 0; }
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { position: static; order: 2; }
  .stage { order: 1; }
  .phone { width: 100%; max-width: 390px; height: 760px; }
  .stage-head { flex-direction: column; align-items: flex-start; }
}


/* --------------------------------- dialog -------------------------------- */
.dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(38, 30, 24, 0.5);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dialog {
  width: min(360px, 90vw);
  background: #fffdf8;
  border: 1px solid #e6dcc9;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(53, 38, 22, 0.24);
}
.dialog-title { font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.dialog-message { font-size: 12px; line-height: 1.85; color: #6e6456; margin-top: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; align-items: center; }
