:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --nav: #1e293b;
  --nav-dark: #111827;
  --text: #142033;
  --muted: #73839b;
  --line: #e5ebf2;
  --green: #09a57a;
  --green-soft: #dcfcef;
  --orange: #d97706;
  --orange-soft: #fff7df;
  --red: #ef4444;
  --red-soft: #fff1f2;
  --blue: #4f8df7;
  --shadow: 0 18px 45px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--nav);
  color: #d8e0ed;
}
.brand {
  height: 92px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  color: #fff;
  font-size: 22px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #10c98f;
  color: #fff;
  font-size: 26px;
}
nav { padding: 18px 12px; display: grid; gap: 8px; }
.nav-item, .logout {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  padding: 0 18px;
  background: transparent;
  color: #c8d3e2;
  font-size: 17px;
  text-align: left;
}
.nav-item.active, .nav-item:hover {
  background: rgba(16, 201, 143, .18);
  color: #12d699;
}
.logout {
  margin-top: auto;
  width: 100%;
  height: 86px;
  border-top: 1px solid rgba(255,255,255,.08);
  border-radius: 0;
}
.content { padding: 44px 56px; min-width: 0; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.owner-filter {
  display: inline-grid;
  grid-template-columns: auto minmax(160px, 220px);
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: #53647c;
}
.owner-filter select {
  min-height: 38px;
  padding: 8px 10px;
}
h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
h2 { margin: 0 0 20px; font-size: 22px; }
p { margin: 6px 0 0; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 14px; }
.month-picker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #53647c;
  font-weight: 700;
}
.month-picker input {
  width: 150px;
  min-height: 42px;
}
.profit-card {
  min-width: 128px;
  padding: 14px 18px;
  border: 1px solid #a9efd8;
  border-radius: 8px;
  background: #e9fff7;
  color: var(--green);
}
.profit-card span { display: block; font-size: 14px; }
.profit-card strong { font-size: 24px; }

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 700;
  white-space: nowrap;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.dark { background: var(--nav); color: #fff; }
.btn.soft { background: #f2f6fa; color: #53647c; }
.btn.mini { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.fill { width: 100%; margin-top: 18px; }

.filters { display: grid; grid-template-columns: 1fr auto; gap: 14px; margin-bottom: 28px; }
.search {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.search input { border: 0; outline: 0; width: 100%; color: var(--text); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  outline: 0;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(9, 165, 122, .12); }

.table-card, .panel, .login-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 5px 18px rgba(16, 24, 40, .03);
}
.table-card { overflow-x: auto; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th, td { padding: 18px 20px; border-bottom: 1px solid #eef2f6; text-align: left; vertical-align: middle; }
th { background: #f8fafc; color: #5d6f88; font-weight: 800; }
tr:last-child td { border-bottom: 0; }
.important-row {
  background: #fffbeb;
}
.important-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #b7791f;
  font-size: 13px;
  font-weight: 800;
}
.person { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d4fbe9;
  color: var(--green);
  font-weight: 900;
  font-size: 18px;
}
.person strong { display: block; margin-bottom: 3px; }
.person small { display: block; color: #7890ad; line-height: 1.55; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
}
.tag.orange { color: var(--orange); background: var(--orange-soft); }
.tag.green { color: var(--green); background: var(--green-soft); }
.tag.red { color: var(--red); background: var(--red-soft); }
.tag.yellow { color: #b7791f; background: #fff7df; }
.row-actions { display: flex; gap: 14px; align-items: center; }
.account-actions { gap: 8px; flex-wrap: wrap; }
.table-input {
  min-width: 120px;
  min-height: 36px;
  padding: 8px 10px;
}
.tiny { margin-top: 4px; font-size: 12px; }
button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: #8da0b8;
  font-size: 20px;
}
.icon-btn.ok { color: var(--green); border: 2px solid var(--green); }
.icon-btn.danger { color: var(--red); border: 2px solid var(--red); }
.green { color: var(--green); font-weight: 900; }
.muted { color: var(--muted); }
.center { text-align: center; }

.metric-grid { display: grid; gap: 20px; margin-bottom: 28px; }
.metric-grid.three { grid-template-columns: repeat(3, 1fr); }
.metric-grid.four { grid-template-columns: repeat(4, 1fr); }
.metric-card {
  min-height: 140px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
.metric-link { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.metric-link:hover {
  transform: translateY(-2px);
  border-color: #b7e8d9;
  box-shadow: 0 12px 28px rgba(16, 24, 40, .08);
}
.metric-card p { margin: 0 0 18px; }
.metric-card strong { font-size: 30px; }
.metric-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 26px;
}
.metric-icon.warn { background: #fff2c8; color: #d97706; }
.metric-icon.blue { background: #dbeafe; color: var(--blue); }
.metric-icon.red { background: #fee2e2; color: var(--red); }
.tabs { display: flex; gap: 10px; margin: 0 0 28px; }
.tab {
  min-height: 36px;
  border-radius: 999px;
  padding: 0 18px;
  background: #eef3f8;
  color: #60748f;
}
.tab.active { background: var(--green); color: #fff; }
.tab.red { background: var(--red); }
.panel { padding: 28px; margin-bottom: 28px; }
.panel.narrow { width: min(860px, 100%); margin-left: auto; margin-right: auto; }
.panel p { margin-bottom: 18px; }
.stat-list { display: grid; gap: 0; }
.stat-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid #eef2f6;
  color: #4b5f78;
}
.stat-list div:last-child { border-bottom: 0; }
.stat-list i {
  width: 14px;
  height: 14px;
  display: inline-block;
  margin-right: 16px;
  border-radius: 50%;
}
.stat-list i.green { background: #39d39d; }
.stat-list i.red { background: #ff6b6b; }
.stat-list b { margin-left: 28px; color: var(--green); }

.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 14px; margin-bottom: 22px; }
.setting-form {
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr auto;
  gap: 14px;
  align-items: stretch;
  margin-bottom: 22px;
}
.setting-form textarea {
  min-height: 52px;
}
.account-form { grid-template-columns: 1fr 1fr 140px 1fr auto; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.chip button { background: transparent; color: #91a4bb; }
.reason-list {
  display: grid;
  gap: 10px;
}
.reason-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}
.business-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.business-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  padding: 14px;
}
.business-card-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.business-card textarea {
  min-height: 138px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.form-page { min-height: 100vh; background: var(--bg); padding-bottom: 60px; }
.form-top {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.form-top h1 { font-size: 24px; }
.back { background: transparent; font-size: 28px; color: #526177; }
.customer-form { padding: 30px 20px; }
.customer-layout {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  margin: 0 auto;
  align-items: start;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: grid; gap: 8px; }
.field span { color: #40516a; }
.field.wide { grid-column: 1 / -1; }
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding-top: 26px;
}
.checkbox-field input {
  width: 18px;
  height: 18px;
}
.appointment-field {
  align-content: start;
}
.appointment-field .btn {
  width: 100%;
}
.hint { margin: 8px 0 0; font-size: 14px; }
.material-panel {
  border-color: #c7f2df;
  background: #fcfffd;
}
.side-material {
  position: sticky;
  top: 24px;
}
.material-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.material-list li {
  position: relative;
  min-height: 34px;
  padding: 7px 10px 7px 34px;
  border: 1px solid #dcefe6;
  border-radius: 8px;
  background: #f7fffb;
  color: #355064;
}
.material-list li:before {
  content: "✓";
  position: absolute;
  left: 10px;
  top: 7px;
  color: var(--green);
  font-weight: 900;
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.follow-row { display: grid; grid-template-columns: 210px 1fr; gap: 16px; padding: 16px; border-radius: 8px; background: #f8fafc; }
.grow { min-width: 0; }
.form-actions {
  width: min(860px, 100%);
  margin: 30px auto 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}
.form-message {
  margin-right: auto;
  color: var(--red);
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, .48);
  z-index: 50;
}
.modal {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  padding: 32px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute;
  top: 22px;
  right: 22px;
  background: transparent;
  color: #8da0b8;
  font-size: 28px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(420px, 100%); padding: 30px; }
.login-brand { height: auto; padding: 0; color: var(--text); }
.message { min-height: 22px; margin-top: 12px; color: var(--red); }
.ico { line-height: 1; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { grid-template-columns: repeat(5, minmax(0, 1fr)); overflow-x: auto; }
  .logout { height: 52px; }
  .content { padding: 24px; }
  .page-head, .filters { grid-template-columns: 1fr; flex-direction: column; }
  .metric-grid.three, .metric-grid.four, .form-grid, .follow-row, .inline-form, .account-form, .setting-form, .business-cards, .business-card-head, .customer-layout, .reason-row { grid-template-columns: 1fr; }
  .owner-filter { grid-template-columns: 1fr; }
  .side-material { position: static; }
}
