:root {
  --primary:#286B4F; --bg:#F5F6F2; --soft:#EDF3EB; --text:#233C32;
  --muted:#66756D; --border:#E7ECE5; --amber:#A67C52; --amber-bg:#FBF3E8; --white:#fff;
  --danger:#B54A3C;
}
* { box-sizing:border-box; margin:0; padding:0; }
body {
  font-family: "PingFang SC","Noto Sans SC",Inter,system-ui,sans-serif;
  background:var(--bg); color:var(--text); min-height:100vh;
}
a { color:var(--primary); text-decoration:none; }
a:hover { text-decoration:underline; }

.app { display:flex; min-height:100vh; }
.sidebar {
  width:220px; background:var(--white); border-right:1px solid var(--border);
  padding:16px 12px; display:flex; flex-direction:column; gap:6px; flex-shrink:0;
  position:sticky; top:0; height:100vh;
}
.brand { display:flex; align-items:center; gap:10px; padding:4px 8px 14px; }
.logo {
  width:36px; height:36px; border-radius:10px; background:var(--primary); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:16px;
}
.brand-name { font-size:15px; font-weight:700; }
.nav {
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px;
  font-size:14px; font-weight:500; color:var(--muted);
}
.nav:hover { background:var(--bg); text-decoration:none; color:var(--text); }
.nav.active { background:var(--soft); color:var(--primary); font-weight:600; }
.sidebar .spacer { flex:1; }
.user-box { display:flex; align-items:center; gap:10px; padding:10px 8px 4px; border-top:1px solid var(--border); margin-top:8px; }
.avatar {
  width:36px; height:36px; border-radius:50%; background:var(--primary); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:600; font-size:14px;
}
.user-name { font-size:13px; font-weight:600; }
.user-role { font-size:11px; color:var(--muted); }
.btn-logout {
  background:none; border:none; color:var(--muted); font-size:12px; cursor:pointer; padding:4px 0;
}
.btn-logout:hover { color:var(--danger); }

.main { flex:1; padding:20px 22px 40px; min-width:0; max-width:1100px; }
.page-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.page-head h1 { font-size:22px; font-weight:700; }
.page-head .sub { font-size:13px; color:var(--muted); margin-top:4px; }

.btn {
  display:inline-flex; align-items:center; gap:6px; border:none; border-radius:8px;
  padding:8px 14px; font-size:13px; font-weight:600; cursor:pointer; background:var(--primary); color:#fff;
}
.btn:hover { opacity:.92; text-decoration:none; }
.btn.secondary { background:var(--white); color:var(--text); border:1px solid var(--border); }
.btn.sm { padding:5px 10px; font-size:12px; }
.btn.block { width:100%; justify-content:center; }

.summary { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:18px; }
.tile {
  background:var(--white); border:1px solid var(--border); border-radius:14px;
  padding:14px 16px; display:flex; flex-direction:column; gap:4px;
}
.tile.active { background:var(--soft); border-color:var(--primary); }
.tile .label { font-size:12px; color:var(--muted); }
.tile .num { font-size:28px; font-weight:700; line-height:1.1; }
.tile .hint { font-size:11px; color:var(--muted); }

.section-title { font-size:14px; font-weight:600; margin:8px 0 10px; }
.cards {
  display:grid; grid-template-columns:1fr 1fr; gap:10px;
}
.card {
  background:var(--white); border:1px solid var(--border); border-radius:12px;
  padding:12px 14px; display:flex; flex-direction:column; gap:6px;
}
.card .row1 { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.name { font-size:14px; font-weight:600; }
.stage {
  background:var(--soft); color:var(--primary); font-size:11px; font-weight:500;
  padding:2px 7px; border-radius:6px; white-space:nowrap;
}
.badge {
  font-size:11px; font-weight:500; padding:2px 7px; border-radius:6px;
  background:#F5F6F2; color:var(--muted); white-space:nowrap;
}
.badge.overdue { background:var(--amber-bg); color:var(--amber); }
.meta { font-size:11px; color:var(--muted); }
.note { font-size:12px; line-height:1.45; color:var(--text);
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.next { font-size:12px; font-weight:500; color:var(--primary); }
.card-actions { display:flex; justify-content:space-between; align-items:center; margin-top:4px; }

.toolbar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; align-items:center; }
.input, .select, textarea {
  border:1px solid var(--border); border-radius:8px; padding:8px 10px;
  font-size:13px; background:var(--white); color:var(--text); font-family:inherit;
}
.input:focus, .select:focus, textarea:focus { outline:2px solid var(--soft); border-color:var(--primary); }
.input.grow { flex:1; min-width:140px; }
textarea { width:100%; min-height:90px; resize:vertical; }

.form-grid {
  display:grid; grid-template-columns:1fr 1fr; gap:12px;
  background:var(--white); border:1px solid var(--border); border-radius:14px; padding:16px;
}
.form-grid .full { grid-column:1 / -1; }
.field label { display:block; font-size:12px; color:var(--muted); margin-bottom:4px; font-weight:500; }
.field .req { color:var(--danger); }

.detail-grid {
  display:grid; grid-template-columns:1.4fr 1fr; gap:14px;
}
.panel {
  background:var(--white); border:1px solid var(--border); border-radius:14px; padding:16px;
}
.panel h2 { font-size:14px; font-weight:600; margin-bottom:12px; }
.kv { display:grid; grid-template-columns:90px 1fr; gap:8px 10px; font-size:13px; }
.kv .k { color:var(--muted); }
.kv .v { font-weight:500; word-break:break-word; }

.comm {
  border-left:3px solid var(--primary); padding:10px 12px; margin-bottom:10px;
  background:var(--soft); border-radius:0 10px 10px 0;
}
.comm .seq { font-size:12px; font-weight:700; color:var(--primary); margin-bottom:4px; }
.comm .body { font-size:13px; line-height:1.5; white-space:pre-wrap; }
.comm .who { font-size:11px; color:var(--muted); margin-top:6px; }

.tabs { display:flex; gap:6px; margin-bottom:14px; }
.tab {
  padding:7px 12px; border-radius:8px; font-size:13px; font-weight:500;
  color:var(--muted); background:var(--white); border:1px solid var(--border);
}
.tab.active { background:var(--soft); color:var(--primary); border-color:var(--primary); font-weight:600; text-decoration:none; }

.bar-list { display:flex; flex-direction:column; gap:8px; }
.bar-row { display:flex; align-items:center; gap:10px; font-size:12px; }
.bar-row .label { width:90px; color:var(--muted); flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-track { flex:1; height:8px; background:var(--bg); border-radius:4px; overflow:hidden; }
.bar-fill { height:100%; background:var(--primary); border-radius:4px; }
.bar-row .val { width:36px; text-align:right; font-weight:600; }

.login-wrap {
  min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px;
  background:linear-gradient(160deg, var(--soft), var(--bg));
}
.login-card {
  width:100%; max-width:380px; background:var(--white); border:1px solid var(--border);
  border-radius:16px; padding:28px 24px; box-shadow:0 8px 24px rgba(35,60,50,.06);
}
.login-card h1 { font-size:20px; margin:12px 0 4px; }
.login-card .sub { color:var(--muted); font-size:13px; margin-bottom:20px; }
.error {
  background:#FBEDEB; color:var(--danger); padding:8px 10px; border-radius:8px;
  font-size:13px; margin-bottom:12px;
}
.mobile-bar {
  display:none; position:fixed; bottom:0; left:0; right:0; background:var(--white);
  border-top:1px solid var(--border); padding:6px 8px calc(6px + env(safe-area-inset-bottom));
  z-index:50; justify-content:space-around;
}
.mobile-bar a {
  flex:1; text-align:center; font-size:11px; color:var(--muted); padding:6px 4px; font-weight:500;
}
.mobile-bar a.active { color:var(--primary); font-weight:700; }

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

@media (max-width: 860px) {
  .sidebar { display:none; }
  .main { padding:16px 14px 80px; }
  .summary { grid-template-columns:1fr 1fr; }
  .cards { grid-template-columns:1fr 1fr; }
  .detail-grid, .form-grid { grid-template-columns:1fr; }
  .mobile-bar { display:flex; }
  .tile .num { font-size:24px; }
}
@media (max-width: 420px) {
  .cards { grid-template-columns:1fr; }
}
