/* 姓名-身份证号-手机号生成工具：简约精致的离线工具站样式 */

:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --ink: #1c2128;
  --ink-soft: #5a6570;
  --ink-mute: #7b8793;
  --line: #d5dbe3;
  --line-strong: #c3cad3;
  --label-bg: #eef1f4;
  --label-ink: #4b5563;
  --primary: #0e9f8a;
  --primary-hover: #0b8b78;
  --primary-active: #097866;
  --primary-soft: #e6f7f3;
  --primary-ring: rgba(14, 159, 138, 0.28);
  --selected: #12a78a;
  --danger: #c0453c;
  --warning-bg: #fff7e8;
  --warning-ink: #8a5a12;
  --warning-line: #f0d7a3;
  --info-bg: #eef8f5;
  --info-ink: #1a6b5c;
  --shadow: 0 1px 2px rgba(22, 28, 36, 0.04), 0 8px 24px rgba(22, 28, 36, 0.06);
  --radius: 10px;
  --control-h: 36px;
  --label-w: 88px;
  --prefix-side-w: 108px;
  --sidebar-w: 220px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #e8f6f2 0%, transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* ===== 整体框架 ===== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #1c2a32;
  color: #d7e0e6;
  padding: 22px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  padding: 4px 10px 8px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(160deg, #1ec2a8, #0c8f7c);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0;
  box-shadow: 0 4px 10px rgba(14, 159, 138, 0.35);
}

.brand h1 {
  margin: 12px 0 4px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #fff;
  line-height: 1.45;
}

.brand p {
  margin: 0;
  font-size: 12px;
  color: #8ea0ab;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #c5d2d9;
  text-align: left;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.is-active {
  background: rgba(18, 167, 138, 0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-item .nav-label {
  font-weight: 600;
}

.nav-item .nav-tag {
  font-size: 11px;
  color: #8ea0ab;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 1px 7px;
}

.nav-item.is-active .nav-tag {
  color: #b7efe3;
  background: rgba(18, 167, 138, 0.28);
}

.sidebar-foot {
  margin-top: auto;
  padding: 0 10px;
  font-size: 12px;
  color: #7e909a;
  line-height: 1.55;
}

/* ===== 主区 ===== */
.main {
  padding: 28px 36px 48px;
  max-width: 1180px;
}

.crumb {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-mute);
}

.crumb span {
  color: var(--ink-soft);
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 22px;
}

.page-head h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary-active);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* ===== 卡片与表单网格 ===== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel.results {
  overflow: hidden;
}

/* 仅当表单是面板第一块时才给顶部加圆角；手机号页上方还有号段区，不能套这条规则 */
.panel > .form-grid:first-child {
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.panel > .form-grid:first-child .form-row:first-child .field:first-child,
.panel > .form-grid:first-child .form-row:first-child .field:first-child .field-label {
  border-top-left-radius: var(--radius);
}

.panel > .form-grid:first-child .form-row:first-child .field:last-child {
  border-top-right-radius: var(--radius);
}

.form-grid {
  border-bottom: 1px solid var(--line);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

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

.form-row-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row-single {
  grid-template-columns: minmax(0, 1fr);
}

.field {
  display: grid;
  grid-template-columns: var(--label-w) minmax(0, 1fr);
  min-height: 52px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.field-span-2 {
  grid-column: span 2;
}

.form-row .field:last-child {
  border-right: 0;
}

.field-empty {
  display: block;
  background: #fff;
}

.field-wide {
  grid-template-columns: var(--label-w) minmax(0, 1fr);
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--label-w);
  min-width: var(--label-w);
  max-width: var(--label-w);
  flex-shrink: 0;
  background: var(--label-bg);
  color: var(--label-ink);
  border-right: 1px solid var(--line);
  font-weight: 600;
  letter-spacing: 0.04em;
  user-select: none;
}

.field-control {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  min-width: 0;
}

.text-input {
  width: 100%;
  height: var(--control-h);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:hover {
  border-color: var(--line-strong);
}

.text-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.text-input::placeholder {
  color: #9aa5af;
}

/* ===== 单选 ===== */
.radios {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.radio input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.radio-dot {
  width: 16px;
  height: 16px;
  border: 1.5px solid #9aa5af;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}

.radio-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  transform: scale(0);
  transition: transform 0.12s ease;
}

.radio:hover .radio-dot,
.radio input:focus-visible + .radio-dot {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.radio input:checked + .radio-dot {
  border-color: var(--primary);
}

.radio input:checked + .radio-dot::after {
  transform: scale(1);
}

/* ===== 自定义下拉 ===== */
.select {
  position: relative;
  width: 100%;
}

.select-trigger {
  appearance: none;
  width: 100%;
  height: var(--control-h);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 32px 0 10px;
  text-align: left;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select-trigger::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #66707a;
  border-bottom: 1.5px solid #66707a;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select-trigger:hover {
  border-color: var(--line-strong);
}

.select-trigger:focus,
.select.is-open .select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  outline: none;
}

.select-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(22, 28, 36, 0.12);
}

.select-menu[hidden] {
  display: none;
}

.select-option {
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--ink);
}

.select-option:hover,
.select-option.is-active {
  background: var(--primary-soft);
  color: var(--primary-active);
}

.select-option.is-selected {
  background: var(--selected);
  color: #fff;
}

.select-option.is-selected:hover,
.select-option.is-selected.is-active {
  background: var(--primary-hover);
  color: #fff;
}

/* ===== 操作按钮 ===== */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 16px 18px;
}

.btn {
  height: 38px;
  min-width: 88px;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 6px 14px rgba(14, 159, 138, 0.22);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:active {
  background: var(--primary-active);
}

.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: #34404a;
}

.btn-ghost:hover {
  border-color: #9aa5af;
  background: #f8fafb;
}

.btn-ghost:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.is-success {
  border-color: var(--primary);
  color: var(--primary-active);
  background: var(--primary-soft);
}

/* ===== 提示与结果 ===== */
.notice {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
}

.notice[hidden] {
  display: none;
}

.notice-error {
  background: #fdf1f0;
  color: var(--danger);
  border: 1px solid #f0c9c6;
}

.notice-warn {
  background: var(--warning-bg);
  color: var(--warning-ink);
  border: 1px solid var(--warning-line);
}

.results {
  margin-top: 20px;
}

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

.results-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.results-meta {
  font-size: 12px;
  color: var(--ink-mute);
}

.results-body {
  margin: 0;
  padding: 16px 18px 20px;
  min-height: 140px;
  max-height: 480px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
}

.results-body.is-empty {
  color: var(--ink-mute);
  white-space: normal;
}

/* ===== 占位页 ===== */
.placeholder {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 56px 32px;
  text-align: center;
}

.placeholder-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.placeholder h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.placeholder p {
  margin: 0 auto;
  max-width: 28em;
  color: var(--ink-soft);
  line-height: 1.8;
  word-break: keep-all;
}

.view[hidden] {
  display: none;
}

/* ===== 轻提示 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: #1c2a32;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.is-error {
  background: #8f2f2a;
}


/* ===== 原生下拉（省市区等长列表） ===== */
.native-select {
  width: 100%;
  height: var(--control-h);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 30px 0 10px;
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, #66707a 50%),
    linear-gradient(135deg, #66707a 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.native-select:hover {
  border-color: var(--line-strong);
}

.native-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.range-inputs,
.date-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.range-inputs[hidden],
.date-inputs[hidden],
.field-hint[hidden] {
  display: none !important;
}

.range-inputs .text-input,
.date-inputs .text-input {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}

.range-sep,
.range-unit {
  flex-shrink: 0;
  color: var(--ink-soft);
}

.field-hint {
  color: var(--ink-mute);
  font-size: 13px;
  line-height: 1.4;
}

.data-source {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.55;
}

/* ===== 结果表格 ===== */
.results-table-wrap {
  overflow: auto;
  max-height: 520px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table th,
.results-table td {
  border-bottom: 1px solid var(--line);
  padding: 0;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.results-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafbfc;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--label-ink);
}

.results-table tbody tr:hover td {
  background: #f7fbfa;
}

.cell-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  min-height: 40px;
}

.cell-text {
  min-width: 0;
}

.copy-icon {
  appearance: none;
  border: 0;
  background: transparent;
  color: #8b959e;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  opacity: 0.55;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.copy-icon:hover,
.copy-icon:focus-visible {
  opacity: 1;
  color: var(--primary-active);
  background: var(--primary-soft);
  outline: none;
}

.copy-icon.is-success {
  opacity: 1;
  color: var(--primary-active);
}

.results-table td .copy-icon {
  opacity: 0;
}

.results-table td:hover .copy-icon,
.results-table td:focus-within .copy-icon,
.copy-icon:focus-visible {
  opacity: 0.85;
}

.results-body:not(pre) {
  padding: 0;
  min-height: 140px;
  white-space: normal;
  overflow: visible;
  max-height: none;
}

.results-body.is-empty {
  padding: 16px 18px 20px;
}


/* ===== 手机号段勾选板 ===== */
.prefix-board {
  border-bottom: 1px solid var(--line);
  background: #fff;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.prefix-board-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 16px 8px;
}

.prefix-board-title {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.prefix-board-hint {
  font-size: 12px;
  color: var(--ink-mute);
}

.prefix-group {
  display: grid;
  grid-template-columns: var(--prefix-side-w) minmax(0, 1fr);
  border-top: 1px solid var(--line);
  min-height: 52px;
}

/* 仅手机号页表单标签与号段左侧深色列同宽，姓名/身份证页仍用 88px */
#view-phone .form-grid {
  --label-w: var(--prefix-side-w);
}

/* 三个控件略收窄、在格子内左对齐，避免拉满单元格显得过宽 */
#view-phone #phone-province {
  width: 240px;
  max-width: 100%;
}

#view-phone #phone-count {
  width: 96px;
  max-width: 100%;
}

#view-phone #phone-separator-select {
  width: 180px;
  max-width: 100%;
}

.prefix-group-side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--label-bg);
  border-right: 1px solid var(--line);
  color: var(--label-ink);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.btn-mini {
  height: 24px;
  min-width: 44px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #34404a;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.btn-mini:hover {
  border-color: var(--primary);
  color: var(--primary-active);
  background: var(--primary-soft);
}

.btn-mini.is-on {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.prefix-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 2px;
  align-items: center;
  padding: 8px 10px 8px 8px;
}

.chk {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
}

.chk:hover {
  background: var(--primary-soft);
}

.chk input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.chk-box {
  width: 15px;
  height: 15px;
  border: 1.5px solid #9aa5af;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.chk-box::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform 0.12s ease;
}

.chk:hover .chk-box,
.chk input:focus-visible + .chk-box {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.chk input:checked + .chk-box {
  border-color: var(--primary);
  background: var(--primary);
}

.chk input:checked + .chk-box::after {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}

.chk-text {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding: 16px 18px;
  }

  .brand {
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .brand h1 {
    margin: 0;
    font-size: 14px;
  }

  .brand p {
    display: none;
  }

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

  .nav-item.is-active {
    box-shadow: inset 0 -3px 0 var(--primary);
  }

  .sidebar-foot {
    display: none;
  }

  .main {
    padding: 20px 16px 36px;
  }

  .form-row,
  .form-row-two,
  .form-row-single {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .form-row .field {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .field-empty {
    display: none;
  }

  .page-head h2 {
    font-size: 22px;
  }

  .prefix-group {
    grid-template-columns: 1fr;
  }

  .prefix-group-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

}
