:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-alt: #eef2f0;
  --ink: #17211f;
  --muted: #68736f;
  --line: #dce3e0;
  --primary: #16785b;
  --primary-dark: #0f5b44;
  --blue: #2f6fa3;
  --amber: #b97812;
  --red: #b83c3c;
  --shadow: 0 8px 28px rgba(23, 33, 31, .07);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.danger-text { color: var(--red); }
.success-text { color: var(--primary); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: min(1440px, 100%);
  min-height: 64px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
}
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.identity { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #a8b0ad; }
.status-dot.ok { background: var(--primary); }
.status-dot.bad { background: var(--red); }

.shell { width: min(1440px, 100%); margin: 0 auto; padding: 24px; }
.site-footer {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary-dark); text-decoration: underline; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 5px; font-size: 27px; line-height: 1.25; letter-spacing: 0; }
.page-head p { margin: 0; color: var(--muted); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 18px; letter-spacing: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.flat { box-shadow: none; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); }
.metric strong { font-size: 29px; line-height: 1; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.content-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.data-item { min-height: 124px; border: 1px solid var(--line); border-radius: 8px; padding: 15px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.data-item h3 { margin: 0; font-size: 16px; line-height: 1.45; letter-spacing: 0; }
.data-item p { margin: 0; color: var(--muted); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.data-item .item-actions { margin-top: auto; }
.empty { padding: 28px 16px; border: 1px dashed #c8d0cd; border-radius: 8px; color: var(--muted); text-align: center; }

.btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.secondary:hover { background: var(--surface-alt); }
.btn.dark { background: var(--ink); }
.btn.blue { background: var(--blue); }
.btn.amber { background: var(--amber); }
.btn.danger { background: var(--red); }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn.icon-only { width: 40px; padding: 0; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.btn svg { width: 17px; height: 17px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: #46514d; font-size: 13px; font-weight: 700; }
.input, .select, .textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd4d0;
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.input, .select { height: 42px; }
.textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,120,91,.12); }
.searchbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 10px; }
.form-message { min-height: 22px; margin: 10px 0 0; color: var(--muted); }

.role-switch, .tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.role-switch button, .tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 13px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}
.role-switch button.active, .tab.active { color: #fff; background: var(--ink); border-color: var(--ink); }
.workspace-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)); gap: 8px; margin-bottom: 18px; }
.workspace-nav .tab { width: 100%; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; background: #fff; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
th { background: var(--surface-alt); color: #46514d; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.cell-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; background: #e8f3ef; color: var(--primary-dark); font-size: 12px; font-weight: 700; }
.badge.pending, .badge.warn, .badge.trial, .badge.unpaid, .badge.expiring, .badge.no_expiry { background: #fff2d8; color: #875300; }
.badge.completed, .badge.published, .badge.active, .badge.approved, .badge.ok, .badge.paid, .badge.standard, .badge.pro, .badge.enterprise, .badge.normal { background: #e8f3ef; color: var(--primary-dark); }
.badge.disabled, .badge.deleted, .badge.rejected, .badge.fail, .badge.overdue, .badge.expired { background: #f8e5e5; color: #8f2828; }

.login-shell { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 28px 20px; }
.login-layout { width: min(1000px, 100%); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.login-context { background: var(--ink); color: #fff; padding: 42px; display: flex; flex-direction: column; justify-content: space-between; min-height: 520px; }
.login-context h1 { margin: 0 0 14px; font-size: 34px; line-height: 1.3; letter-spacing: 0; }
.login-context p { margin: 0; color: #c9d2cf; line-height: 1.8; }
.role-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; }
.role-list div { border: 1px solid #3b4844; border-radius: 8px; padding: 14px; }
.role-list b { display: block; margin-bottom: 5px; }
.sales-entry { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 25px; padding-top: 16px; border-top: 1px solid #3b4844; color: #c9d2cf; font-size: 12px; }
.sales-entry a { display: inline-flex; align-items: center; min-height: 34px; padding: 0 11px; border: 1px solid #6ca58e; border-radius: 6px; color: #fff; font-weight: 800; text-decoration: none; white-space: nowrap; }
.sales-entry a:hover { background: rgba(108, 165, 142, .18); }
.login-panel { background: #fff; padding: 38px; display: flex; flex-direction: column; justify-content: center; }
.login-panel h2 { margin: 0 0 6px; font-size: 23px; }
.login-panel .role-switch { margin: 22px 0; }
.owner-actions { display: grid; gap: 10px; }
.owner-actions .btn { width: 100%; }
.owner-actions .wechat { background: #16834f; }
.owner-actions .wechat:hover { background: #106b40; }
.auth-alternatives { display: grid; grid-template-columns: 1fr 1fr; }
.role-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.role-switch button svg { width: 16px; height: 16px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(15, 25, 22, .58); }
.modal { width: min(680px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: #fff; border-radius: 8px; border: 1px solid var(--line); box-shadow: 0 24px 70px rgba(0,0,0,.2); }
.modal-head, .modal-foot { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.modal-head { border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-body { padding: 20px; }
.modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .content-grid, .content-grid.three { grid-template-columns: 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-context { min-height: auto; padding: 30px; }
}

@media (max-width: 640px) {
  .topbar-inner, .shell { padding-left: 14px; padding-right: 14px; }
  .site-footer { padding-left: 14px; padding-right: 14px; gap: 10px 14px; }
  .topbar-inner { align-items: flex-start; }
  .brand span:last-child { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head h1 { font-size: 23px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric { min-height: 92px; padding: 15px; }
  .metric strong { font-size: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .searchbar { grid-template-columns: 1fr; }
  .item-grid { grid-template-columns: 1fr; }
  .login-panel, .login-context { padding: 24px; }
  .login-context h1 { font-size: 27px; }
  .role-list { grid-template-columns: 1fr; }
  .role-switch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .role-switch button { padding-left: 8px; padding-right: 8px; }
  .auth-alternatives { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 8px; }
  .modal { max-height: calc(100vh - 16px); }
}

/* 2026-07-15: clearer owner WeChat auth entry */
.owner-actions .wechat { background: #1aad19; }
.owner-actions .btn { width: 100%; }
.auth-alternatives.hidden, .owner-actions.hidden { display: none !important; }

/* 2026-07-15: mobile login first and owner auth visible by default */
@media (max-width: 980px) {
  .login-panel { order: -1; }
}
@media (max-width: 640px) {
  .login-shell { padding-top: 14px; }
  .login-panel { padding: 22px; }
  .login-panel .role-switch { margin: 16px 0; }
  .login-context { padding: 20px 22px; }
  .login-context .role-list { display: none; }
}

/* 2026-07-15: expandable long text */
.more-text { margin-top: 2px; color: var(--muted); }
.more-text summary { cursor: pointer; width: max-content; color: var(--primary); font-weight: 800; list-style: none; }
.more-text summary::-webkit-details-marker { display: none; }
.more-text summary::after { content: '查看全部'; }
.more-text[open] summary::after { content: '收起'; }
.more-text p, .more-text div { margin: 8px 0 0; color: var(--muted); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.table-more { margin-top: 6px; }
.table-more-text { line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 2026-07-15: list level more button */
.list-more { grid-column: 1 / -1; display: flex; justify-content: center; padding: 4px 0 2px; }
.list-more .btn { min-width: 160px; }

/* 2026-07-15: admin search pagination import/export */
.admin-toolbar { margin: -2px 0 14px; display: grid; grid-template-columns: minmax(220px, 1fr) auto auto auto auto auto; gap: 10px; align-items: center; }
.admin-toolbar .input, .admin-toolbar .select { height: 40px; }
.admin-toolbar .btn[disabled] { opacity: .5; cursor: not-allowed; }
@media (max-width: 760px) { .admin-toolbar { grid-template-columns: 1fr 1fr; } .admin-toolbar .input { grid-column: 1 / -1; } }

/* 2026-07-15: repair image gallery */
.image-gallery { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.image-gallery a { display: inline-flex; }
.image-gallery img { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-alt); }
td .image-gallery img { width: 52px; height: 52px; }

/* Public property SaaS promotion page */
.sales-page { background: var(--bg); }
.sales-main { width: min(1160px, 100%); margin: 0 auto; padding: 56px 24px 24px; }
.sales-nav { display: flex; align-items: center; gap: 12px; }
.sales-nav a { text-decoration: none; }
.sales-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); gap: 64px; align-items: center; min-height: 500px; }
.sales-kicker { display: inline-flex; align-items: center; min-height: 28px; padding: 0 9px; border-left: 3px solid var(--primary); color: var(--primary-dark); font-size: 12px; font-weight: 800; }
.sales-hero h1 { max-width: 600px; margin: 20px 0 17px; font-size: 54px; line-height: 1.15; letter-spacing: 0; }
.sales-hero-copy > p { max-width: 540px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.9; }
.sales-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.sales-proof { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 28px; color: var(--muted); font-size: 12px; }
.sales-proof span { display: inline-flex; align-items: center; gap: 7px; }
.sales-proof span::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.sales-visual { position: relative; display: flex; align-items: flex-end; justify-content: center; min-height: 480px; padding: 28px 28px 0; border: 1px solid var(--line); border-radius: 8px; background: #eaf0ee; box-shadow: var(--shadow); }
.sales-visual img { display: block; width: min(100%, 300px); max-height: 540px; object-fit: contain; object-position: bottom; border: 8px solid #17211f; border-bottom: 0; border-radius: 20px 20px 0 0; box-shadow: 0 18px 34px rgba(23, 33, 31, .16); }
.sales-visual-caption { position: absolute; right: 16px; bottom: 15px; left: 16px; color: #52625b; font-size: 11px; text-align: center; }
.sales-section { margin-top: 92px; }
.sales-section-head { max-width: 660px; margin-bottom: 25px; }
.sales-section-head h2 { margin: 0; font-size: 29px; line-height: 1.3; }
.sales-section-head p { margin: 9px 0 0; color: var(--muted); line-height: 1.8; }
.sales-workflow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sales-workflow article { min-height: 150px; padding: 22px 20px 22px 0; border-right: 1px solid var(--line); }
.sales-workflow article + article { padding-left: 20px; }
.sales-workflow article:last-child { border-right: 0; }
.sales-workflow strong { display: block; margin-bottom: 9px; font-size: 15px; }
.sales-workflow p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.sales-plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sales-plan { position: relative; min-height: 292px; display: flex; flex-direction: column; padding: 21px 19px 19px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.sales-plan.featured { border-color: #9cc6b4; box-shadow: 0 8px 24px rgba(31, 122, 90, .1); }
.sales-plan-label { min-height: 19px; color: var(--primary-dark); font-size: 10px; font-weight: 800; }
.sales-plan h3 { margin: 8px 0 5px; font-size: 19px; }
.sales-plan > p { min-height: 40px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.sales-plan ul { margin: 17px 0 20px; padding-left: 17px; color: #4d5c54; font-size: 11px; line-height: 2; }
.sales-plan .sales-plan-note { margin-top: auto; color: var(--primary-dark); font-size: 11px; font-weight: 800; }
.sales-callout { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 25px 28px; border: 1px solid #c9dcd4; border-radius: 8px; background: #f5faf7; }
.sales-callout h2 { margin: 0; font-size: 21px; }
.sales-callout p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.sales-footer { margin-top: 72px; }
.sales-lead-layout { display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr); gap: 28px; align-items: start; }
.sales-lead-aside { padding: 24px 0; border-top: 2px solid var(--primary); }
.sales-lead-aside strong { display: block; margin-bottom: 13px; font-size: 16px; }
.sales-lead-aside ul { margin: 0; padding-left: 18px; color: #4d5c54; font-size: 12px; line-height: 2; }
.sales-lead-aside p { margin: 22px 0 0; font-size: 11px; line-height: 1.7; }
.sales-lead-form { padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.sales-lead-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sales-lead-fields .field.full { grid-column: 1 / -1; }
.sales-lead-form .field label { display: block; margin-bottom: 6px; color: var(--ink); font-size: 12px; font-weight: 700; }
.sales-lead-form .input, .sales-lead-form .select, .sales-lead-form .textarea { width: 100%; }
.sales-lead-form .textarea { min-height: 94px; resize: vertical; }
.sales-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sales-consent { display: flex; align-items: flex-start; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.sales-consent input { flex: 0 0 auto; margin-top: 3px; accent-color: var(--primary); }
.sales-consent a { color: var(--primary-dark); }
.sales-lead-submit { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.sales-lead-submit .btn[disabled] { opacity: .6; cursor: wait; }
.sales-lead-submit .form-message { margin: 0; }

@media (max-width: 900px) {
  .sales-main { padding-top: 34px; }
  .sales-hero { grid-template-columns: 1fr; gap: 35px; min-height: 0; }
  .sales-hero h1 { font-size: 44px; }
  .sales-visual { min-height: 420px; }
  .sales-workflow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-workflow article:nth-child(2) { border-right: 0; }
  .sales-workflow article:nth-child(n+3) { border-top: 1px solid var(--line); }
  .sales-plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sales-lead-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .sales-main { padding: 25px 14px 14px; }
  .sales-nav a:first-child { display: none; }
  .sales-hero h1 { font-size: 36px; }
  .sales-hero-copy > p { font-size: 15px; }
  .sales-visual { min-height: 360px; padding: 18px 18px 0; }
  .sales-visual img { width: min(74%, 250px); }
  .sales-section { margin-top: 60px; }
  .sales-section-head h2 { font-size: 24px; }
  .sales-workflow { display: block; }
  .sales-workflow article, .sales-workflow article + article { min-height: 0; padding: 17px 0; border-right: 0; border-top: 1px solid var(--line); }
  .sales-workflow article:first-child { border-top: 0; }
  .sales-plan-grid { grid-template-columns: 1fr; }
  .sales-plan { min-height: 0; }
  .sales-callout { align-items: flex-start; flex-direction: column; padding: 22px 18px; }
  .sales-lead-form { padding: 18px; }
  .sales-lead-fields { grid-template-columns: 1fr; }
  .sales-lead-fields .field.full { grid-column: auto; }
  .sales-lead-submit { align-items: flex-start; flex-direction: column; }
  .sales-footer { margin-top: 45px; }
}
