:root {
  --ink: #173b37;
  --green: #176d58;
  --muted: #72817d;
  --line: #e0e9e4;
  --bg: #f4f7f3;
  --accent: #edf5cc;
  --red: #ba4d45;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  font-size: 14px;
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-color: var(--green);
}
button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  padding: 10px 16px;
  cursor: pointer;
  line-height: 1.25;
}
button:hover {
  background: #eaf2eb;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
button.danger {
  color: var(--red);
}
button.small {
  padding: 7px 11px;
  font-size: 12px;
}
a {
  color: var(--green);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 28px;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
h2 {
  font-size: 20px;
}
h3 {
  font-size: 15px;
}
small,
.muted {
  color: var(--muted);
  line-height: 1.7;
}
.shell {
  display: grid;
  grid-template-columns: 225px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #133f35;
  color: #d8e7dc;
  padding: 32px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 10px 34px;
  font-size: 22px;
  font-weight: 700;
  color: white;
}
.brand span {
  background: #dcefad;
  color: #234e3e;
  border-radius: 12px;
  padding: 9px;
  font-size: 21px;
}
.brand small {
  font-size: 10px;
  display: block;
  color: #a8c0b0;
  letter-spacing: 2px;
  font-weight: 400;
  margin-top: 5px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav button {
  background: transparent;
  border: 0;
  color: #bcd3c7;
  text-align: left;
  padding: 13px 16px;
}
.nav button.active {
  background: #dcefad;
  color: #1b493a;
  font-weight: 600;
}
.nav button:hover {
  background: #2a5748;
  color: white;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 24px 10px 0;
  border-top: 1px solid #386253;
  line-height: 1.7;
}
.sidebar-bottom small {
  color: #a8c0b0;
}
.sidebar-bottom button {
  margin-top: 14px;
  padding: 7px 10px;
  background: transparent;
  border-color: #4b6e60;
  color: white;
}
.main {
  padding: 35px 42px;
  max-width: 1600px;
  min-width: 0;
}
.topbar,
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar {
  justify-content: space-between;
  margin-bottom: 28px;
}
.eyebrow {
  font-size: 11px;
  color: var(--green);
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 12px;
}
.demo-banner {
  background: #fff7dd;
  border: 1px solid #ebdfb7;
  border-radius: 10px;
  padding: 11px 16px;
  margin-bottom: 24px;
  color: #7c682e;
  font-size: 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.stat {
  padding: 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 15px;
}
.stat strong {
  display: block;
  font-size: 34px;
  margin: 15px 0 8px;
  letter-spacing: -1px;
}
.stat.accent {
  background: var(--accent);
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  margin-bottom: 20px;
}
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.panel-title h2 {
  margin: 0;
}
.grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.filters input {
  min-width: 230px;
  flex: 1;
}
.filters select {
  width: auto;
  max-width: 220px;
}
input,
select,
textarea {
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
}
textarea {
  resize: vertical;
  min-height: 95px;
}
label {
  display: block;
  font-size: 12px;
  color: #597067;
  margin-bottom: 6px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  text-align: left;
}
th {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 12px;
  background: #f7f9f6;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 16px 12px;
  border-bottom: 1px solid #edf1ec;
  font-size: 13px;
}
td small {
  display: block;
  font-size: 11px;
}
.link {
  border: 0;
  background: transparent;
  padding: 0;
  font-weight: 600;
  text-align: left;
}
.badge {
  display: inline-block;
  border-radius: 6px;
  background: #eff3ef;
  padding: 5px 8px;
  color: #5b7063;
  font-size: 11px;
}
.badge.following {
  background: #fff1d4;
  color: #9b721f;
}
.badge.cooperating {
  background: #e2f2e7;
  color: #267b4b;
}
.badge.new {
  background: #e9effa;
  color: #5071a9;
}
.due {
  color: var(--red);
}
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.progress {
  height: 8px;
  border-radius: 8px;
  background: #e7eee3;
  overflow: hidden;
  margin-top: 18px;
}
.progress > div {
  height: 100%;
  background: var(--green);
}
.list-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.list-row:last-child {
  border-bottom: 0;
}
.list-row strong {
  display: block;
  margin-bottom: 7px;
}
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-art {
  background: #153f35;
  color: white;
  padding: 12vh 8vw;
  position: relative;
  overflow: hidden;
}
.login-art .brand {
  margin-left: 0;
}
.login-art h1 {
  font-size: 44px;
  line-height: 1.5;
  margin-top: 85px;
}
.login-art p {
  color: #bcd0c1;
  line-height: 2;
  max-width: 400px;
}
.orbit {
  position: absolute;
  width: 500px;
  height: 500px;
  border: 1px solid #466b54;
  border-radius: 50%;
  bottom: -250px;
  right: -200px;
  box-shadow:
    0 0 0 65px #1b4738,
    0 0 0 66px #466b54,
    0 0 0 130px #1b4738;
}
.login-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-card {
  width: 370px;
}
.login-card h2 {
  font-size: 26px;
  margin-bottom: 10px;
}
.login-card form {
  margin-top: 30px;
}
.field {
  margin-bottom: 18px;
}
.login-card button[type="submit"] {
  width: 100%;
  margin-top: 10px;
}
.demo-users {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.demo-users button {
  flex: 1;
  font-size: 12px;
  padding: 10px 5px;
}
.error {
  color: var(--red);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin: 12px 0;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  max-width: 800px;
  width: calc(100% - 40px);
  max-height: 90vh;
  padding: 28px;
  color: var(--ink);
  box-shadow: 0 24px 90px #163d352a;
}
dialog::backdrop {
  background: #153c3566;
  backdrop-filter: blur(3px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.modal-head h2 {
  margin-bottom: 6px;
}
.close {
  padding: 5px 10px;
  font-size: 23px;
  border: 0;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.full {
  grid-column: 1/-1;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.detail-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 20px;
  background: #f5f8f1;
  border-radius: 10px;
  margin-bottom: 18px;
}
.detail-summary span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}
.timeline {
  border-left: 2px solid #dce9dc;
  margin: 25px 0 5px 7px;
  padding-left: 23px;
}
.timeline-item {
  position: relative;
  margin-bottom: 26px;
}
.timeline-item:before {
  content: "";
  position: absolute;
  left: -30px;
  top: 5px;
  width: 10px;
  height: 10px;
  background: var(--green);
  border: 2px solid white;
  border-radius: 50%;
}
.timeline-item p {
  margin: 12px 0;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.photos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.photos img {
  width: 85px;
  height: 85px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}
.plan-number {
  width: 35px;
  height: 35px;
  background: var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #143f35;
  color: white;
  border-radius: 10px;
  padding: 13px 22px;
  z-index: 100;
  display: none;
  max-width: 90vw;
  box-shadow: 0 5px 30px #0002;
}
.notice {
  font-size: 12px;
  line-height: 1.8;
  padding: 13px;
  border-radius: 8px;
  background: #f1f5eb;
  margin: 15px 0;
}
.code {
  font-family: monospace;
  word-break: break-all;
  padding: 15px;
  background: #eef4e8;
  border-radius: 8px;
}
.split {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
}
.loading {
  padding: 100px;
  text-align: center;
  color: var(--muted);
}
@media (max-width: 1050px) {
  .main {
    padding: 28px 24px;
  }
  .shell {
    grid-template-columns: 180px 1fr;
  }
  .sidebar {
    padding: 25px 12px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .login-art {
    padding: 10vh 5vw;
  }
  .login-art h1 {
    font-size: 36px;
  }
}
@media (max-width: 700px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 14px 16px;
  }
  .brand {
    margin: 0;
    font-size: 18px;
  }
  .brand small,
  .sidebar-bottom {
    display: none;
  }
  .nav {
    flex-direction: row;
    overflow: auto;
    margin-top: 16px;
    gap: 4px;
  }
  .nav button {
    white-space: nowrap;
    padding: 10px;
  }
  .main {
    padding: 24px 16px;
  }
  .topbar {
    align-items: flex-start;
  }
  h1 {
    font-size: 23px;
  }
  .stat {
    padding: 16px;
  }
  .stat strong {
    font-size: 28px;
  }
  .panel {
    padding: 18px;
  }
  .topbar .row {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .detail-summary {
    grid-template-columns: 1fr;
  }
  .login {
    display: block;
  }
  .login-art {
    display: none;
  }
  .login-side {
    min-height: 100vh;
    padding: 25px;
  }
  .filters input {
    min-width: 100%;
  }
  .list-row {
    flex-wrap: wrap;
  }
  dialog {
    padding: 20px;
  }
  .full {
    grid-column: auto;
  }
}

.list-row > div > small {
  display: block;
  margin-top: 7px;
}
.list-row .link {
  line-height: 1.6;
}

.brand > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.brand > span {
  flex: none;
}
.brand small {
  overflow-wrap: normal;
}

dialog.import-modal { width: min(1080px, 96vw); max-width: 96vw; }
.import-wizard h3 { margin: 24px 0 14px; }
.import-wizard p { line-height: 1.7; margin: 10px 0; }
.import-field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 12px 20px; }
.import-check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; line-height: 1.7; }
.import-check input { width: auto; min-height: 0; margin-top: 7px; flex: none; }
.import-wizard [hidden] { display: none !important; }
dialog [hidden] { display: none !important; }
.customer-select { width: 18px; min-height: 18px; accent-color: #187357; }
.customer-bulk { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.import-table td table { min-width: 320px; }
.import-table td table th { position: static; }
.import-table td table td { white-space: pre-wrap; overflow-wrap: anywhere; }
.import-table { max-height: 320px; overflow: auto; border: 1px solid #e0e9e1; border-radius: 8px; }
.import-table th { position: sticky; top: 0; background: #edf5f0; }
.import-wizard small { display: block; line-height: 1.6; margin-top: 5px; }
.import-wizard details { padding: 12px; background: #f4f7f3; border-radius: 8px; }
.import-wizard summary { cursor: pointer; margin-bottom: 10px; }
.work-row { display:flex; justify-content:space-between; align-items:center; gap:18px; padding:18px 0; border-bottom:1px solid #edf1ed; }
.work-row>div:first-child { flex:1; min-width:0; }
.work-row small { display:block; }
.work-reason { margin:8px 0; }
@media(max-width:850px) { .work-row { align-items:flex-start; flex-direction:column; } }

.visit-normal { color:#207b62; }
.visit-soon { color:#8b6900; }
.visit-today { color:#ba5b16; }
.visit-overdue { color:#b3343c; }
.visit-pending { color:#396aa4; }
.visit-paused { color:#727b83; }
button.todo-overdue { color:#b3343c; background:#fff0f1; border-color:#e8b8bc; }
button.todo-overdue.primary { color:#fff; background:#b3343c; border-color:#b3343c; }
button.todo-today { color:#ba5b16; background:#fff4e8; border-color:#ebc8a8; }
button.todo-today.primary { color:#fff; background:#ba5b16; border-color:#ba5b16; }
