:root {
  --green: #00a73c;
  --green-dark: #008631;
  --ink: #14231a;
  --muted: #667a6e;
  --line: #e4ebe6;
  --bg: #f4f7f5;
  --card: #ffffff;
  --danger: #c0392b;
  --shadow: 0 18px 44px -30px rgba(20, 35, 26, 0.35);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(0, 167, 60, 0.14) 0%, rgba(0, 167, 60, 0) 60%),
    var(--bg);
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 18px 6px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 12px;
  background: linear-gradient(145deg, #00b842, #008631);
  color: #fff;
  font-size: 21px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px -12px rgba(0, 134, 49, 0.8);
}
.brand-name { font-size: 16px; font-weight: 650; letter-spacing: .3px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; white-space: nowrap; }

.userbox { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.who { text-align: right; line-height: 1.25; }
.who b { display: block; font-size: 13px; font-weight: 600; }
.who span { font-size: 11px; color: var(--muted); }

.container { max-width: 920px; margin: 0 auto; padding: 10px 18px 40px; }

.hero { padding: 20px 2px 10px; }
.hero h1 { margin: 0; font-size: clamp(22px, 5vw, 30px); letter-spacing: .5px; }
.hero p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 22px 2px 10px;
}
.section-head h2 { margin: 0; font-size: 15px; letter-spacing: .3px; }
.section-head .hint { font-size: 12px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 8px; }
}

.svc {
  display: flex; flex-direction: column;
  min-height: 118px;
  padding: 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px -24px rgba(20, 35, 26, 0.35);
  text-decoration: none; color: inherit;
  transition: transform .12s ease, border-color .18s ease;
}
.svc:hover { text-decoration: none; border-color: #cfe4d7; transform: translateY(-1px); }
.svc:active { transform: scale(.99); }
.svc .ico {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: #eaf7ef; color: var(--green);
  margin-bottom: 10px;
}
.svc .ico svg { width: 20px; height: 20px; }
.svc .t { font-size: 14px; font-weight: 650; line-height: 1.35; }
.svc .d { margin-top: 4px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.svc .arrow { margin-top: auto; align-self: flex-end; color: #9fb2a7; font-size: 16px; }
.svc.pub { background: #fbfefc; }

.login-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding: 16px;
  border: 1px dashed #b9d9c5; border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}
.login-cta .t { font-size: 14px; font-weight: 600; }
.login-cta .d { margin-top: 3px; font-size: 12px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #eef4f0; color: var(--ink);
  font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: filter .15s ease, transform .1s ease;
}
.btn:hover { text-decoration: none; filter: brightness(.98); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: linear-gradient(140deg, #00b842, #00912f); color: #fff; }
.btn-ghost { background: transparent; border-color: #d7e3db; color: var(--ink); }
.btn-link { background: transparent; color: var(--green-dark); padding: 0 6px; height: 30px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-danger { background: #fdf0ee; color: var(--danger); }

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

.form-wrap { max-width: 440px; margin: 6vh auto 0; padding: 0 16px; }
.form-card { padding: 26px 22px 22px; }
.form-card h1 { margin: 0 0 4px; font-size: 21px; }
.form-card .sub { margin: 0 0 20px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid #dbe5df; border-radius: 10px;
  background: #fbfdfc; color: var(--ink);
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--green); background: #fff; }
.field .tip { margin-top: 5px; font-size: 11px; color: #8a9a90; line-height: 1.5; }
.form-actions { margin-top: 20px; }
.form-actions .btn { width: 100%; height: 44px; }
.msg { display: none; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.6; }
.msg.show { display: block; }
.msg.err { background: #fdf0ee; color: #a5342a; border: 1px solid #f3d3cf; }
.msg.ok { background: #edf9f1; color: #157a3a; border: 1px solid #cdebd8; }
.form-foot { margin-top: 16px; text-align: center; font-size: 12.5px; color: var(--muted); }
.form-foot a { font-weight: 600; }

.footer {
  max-width: 920px; margin: 0 auto; padding: 18px;
  text-align: center; color: #8a9a90; font-size: 11.5px; line-height: 1.9;
}

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .2px;
  background: #eaf7ef; color: #157a3a;
}
.badge.owner { background: #eaf1fb; color: #2b5fa8; }
.badge.brand { background: #eef6fb; color: #2b6f8f; }
.badge.hq { background: #eef2fb; color: #4a5fa8; }
.badge.admin { background: #f4ecfb; color: #6b3fa0; }

.empty { padding: 30px 10px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------------- 管理端 ---------------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 12px; }
.admin-head h1 { margin: 0; font-size: 20px; }
.tabs { display: flex; gap: 6px; margin: 14px 0 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 13px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .7); font-size: 12.5px; cursor: pointer; color: var(--muted);
}
.tab.active { background: #fff; border-color: #bfe0cb; color: var(--green-dark); font-weight: 650; }
.panel { display: none; }
.panel.active { display: block; }
.use-ok { color: #078a4e; font-weight: 600; white-space: nowrap; }
.use-no { color: #d97706; font-weight: 600; white-space: nowrap; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type="search"] { height: 36px; padding: 0 10px; border: 1px solid #dbe5df; border-radius: 9px; background: #fff; min-width: 180px; }
.toolbar select { height: 36px; padding: 0 8px; border: 1px solid #dbe5df; border-radius: 9px; background: #fff; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 1000px; }
th, td { padding: 10px 12px; text-align: left; font-size: 12.5px; border-bottom: 1px solid #eef3f0; vertical-align: middle; }
th { background: #f8fbf9; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td input, td select {
  height: 30px; padding: 0 8px; border: 1px solid #dbe5df; border-radius: 7px; background: #fff; font-size: 12px;
  max-width: 150px;
}
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.import-box { padding: 18px; }
.import-box h2 { margin: 0 0 6px; font-size: 15px; }
.import-box p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.import-box input[type="file"] { display: block; margin-bottom: 12px; font-size: 12.5px; }
.import-result { margin-top: 14px; }
.import-result ul { margin: 8px 0 0; padding-left: 18px; color: #a5342a; font-size: 12px; line-height: 1.7; max-height: 220px; overflow: auto; }
.pager { display: flex; justify-content: flex-end; gap: 8px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  max-width: 86vw; padding: 10px 14px; border-radius: 10px;
  background: rgba(20, 35, 26, .92); color: #fff; font-size: 12.5px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 99;
}
.toast.show { opacity: 1; }
.toast.err { background: rgba(160, 40, 30, .95); }

@media (max-width: 560px) {
  .topbar { padding: 14px 14px 4px; }
  .container { padding: 8px 14px 30px; }
  .brand-sub { display: none; }
  .form-wrap { margin-top: 2vh; }
  .login-cta { flex-direction: column; align-items: flex-start; }
  .login-cta .btn { width: 100%; }
}
