*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",Arial,sans-serif;background:#f5f7fb;color:#101828}
a{color:inherit}
.app-shell{display:flex;min-height:100vh}
.app-sidebar{position:fixed;left:0;top:0;bottom:0;width:248px;background:linear-gradient(180deg,#0f2747 0%,#08182c 100%);padding:24px 16px;color:#fff;z-index:20}
.app-brand{font-size:22px;font-weight:800;margin-bottom:28px;letter-spacing:.2px}
.app-nav a{display:block;text-decoration:none;color:#dbe8ff;padding:12px 14px;border-radius:12px;margin-bottom:6px;font-weight:650}
.app-nav a:hover{background:rgba(255,255,255,.11);color:#fff}
.app-nav a:first-child{background:#2563eb;color:#fff}
.app-nav-title{font-size:12px;color:#8fb1dc;margin:20px 12px 8px;font-weight:800}
.app-main{margin-left:248px;width:calc(100% - 248px);min-height:100vh}
.app-topbar{height:72px;background:rgba(255,255,255,.9);border-bottom:1px solid #e6ebf3;display:flex;align-items:center;justify-content:space-between;padding:0 32px;position:sticky;top:0;z-index:10;backdrop-filter:blur(14px)}
.top-search{display:flex;gap:10px;align-items:center}
.top-search input{width:480px;max-width:52vw;border:1px solid #d8e0ec;border-radius:999px;background:#f8fafc;padding:12px 18px;font-size:15px;outline:none}
.top-search button,.searchbar button,.btn-primary{border:0;background:#2563eb;color:#fff;border-radius:12px;padding:12px 18px;font-weight:800;cursor:pointer;text-decoration:none;display:inline-block}
.user-area{display:flex;gap:16px;align-items:center;font-weight:700}
.user-area a{color:#2563eb;text-decoration:none}
.app-content{padding:32px}
.page-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px}
.page-header h1{font-size:30px;margin:0 0 8px;font-weight:850}
.page-header p{margin:0;color:#667085}
.dashboard-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px;margin-bottom:22px}
.dash-card{display:flex;gap:16px;align-items:center;text-decoration:none;background:#fff;border:1px solid #e7edf6;border-radius:22px;padding:22px;box-shadow:0 12px 30px rgba(15,35,65,.06)}
.dash-card h3{margin:0 0 8px;font-size:18px}
.dash-card p{margin:0;color:#667085}
.dash-icon{width:52px;height:52px;border-radius:16px;color:#fff;display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:900;flex:none}
.blue{background:#3b82f6}.purple{background:#8b5cf6}.green{background:#10b981}.orange{background:#f97316}
.dashboard-grid{display:grid;grid-template-columns:1.1fr .9fr;gap:22px}
.panel{background:#fff;border:1px solid #e7edf6;border-radius:22px;padding:24px;margin-bottom:22px;box-shadow:0 12px 30px rgba(15,35,65,.06)}
.panel-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
.panel-head h2{margin:0;font-size:20px}
.panel-head span{color:#667085}
.quick-actions{display:flex;flex-wrap:wrap;gap:12px}
.quick-actions a{background:#f2f6ff;color:#1d4ed8;text-decoration:none;padding:12px 16px;border-radius:12px;font-weight:800}
.empty-state{padding:20px;background:#f8fafc;border:1px dashed #d8e0ec;border-radius:16px;color:#667085}
.empty-state strong{color:#101828}
.searchbar{display:flex;gap:12px}
.searchbar input{flex:1;border:1px solid #d8e0ec;border-radius:14px;padding:14px 16px;font-size:16px;outline:none}
.data-table{width:100%;border-collapse:collapse}
.data-table th{background:#f8fafc;color:#344054;text-align:left;padding:15px;font-weight:850;border-bottom:1px solid #e7edf6}
.data-table td{padding:15px;border-bottom:1px solid #edf1f7;vertical-align:top}
.data-table tr:hover td{background:#fbfcff}
.company-name{font-weight:800}
pre{white-space:pre-wrap;margin:0;font-family:inherit;max-height:160px;overflow:auto}
.link{color:#2563eb;text-decoration:none;font-weight:800}
.notice{margin-top:14px;background:#fff7ed;border:1px solid #fed7aa;color:#9a3412;padding:12px 14px;border-radius:12px;font-weight:700}
.empty-box{margin-top:16px;background:#f8fafc;border:1px dashed #d8e0ec;color:#667085;padding:16px;border-radius:12px}
.pager{display:flex;gap:14px;align-items:center;justify-content:center;margin-top:22px}
.pager a{background:#f2f4f7;color:#344054;text-decoration:none;padding:9px 14px;border-radius:10px;font-weight:800}
.form-block{display:grid;gap:12px}
.form-block input{border:1px solid #d8e0ec;border-radius:12px;padding:12px;font-size:15px}
.form-block label{font-weight:800;color:#344054}
@media(max-width:1100px){.dashboard-cards{grid-template-columns:repeat(2,1fr)}.dashboard-grid{grid-template-columns:1fr}.top-search input{width:320px}}


/* V19 CRM Customer Operations */
.pipeline{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
}
.stage{
  background:#f8fafc;
  border:1px solid #e7edf6;
  border-radius:16px;
  padding:18px;
}
.stage strong{display:block;margin-bottom:8px;color:#101828}
.stage span{color:#667085;font-size:14px}
.todo-list{display:grid;gap:12px}
.todo-item{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:14px;
  border:1px solid #edf1f7;
  border-radius:16px;
  background:#fbfcff;
}
.todo-item p{margin:5px 0 0;color:#667085}
.todo-dot{width:10px;height:10px;border-radius:99px;margin-top:7px;flex:none}
.crm-toolbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:18px;
}
.crm-toolbar a{
  text-decoration:none;
  background:#fff;
  border:1px solid #e7edf6;
  color:#344054;
  border-radius:999px;
  padding:10px 14px;
  font-weight:800;
}
.customer-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:18px;
}
.customer-card{
  background:#fff;
  border:1px solid #e7edf6;
  border-radius:22px;
  padding:20px;
  box-shadow:0 12px 30px rgba(15,35,65,.06);
}
.customer-head{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:18px;
}
.avatar{
  width:48px;height:48px;border-radius:16px;
  background:linear-gradient(135deg,#2563eb,#8b5cf6);
  color:#fff;display:flex;align-items:center;justify-content:center;
  font-size:22px;font-weight:900;flex:none;
}
.customer-head h3{margin:0 0 5px;font-size:18px}
.customer-head p{margin:0;color:#667085}
.status-pill{
  margin-left:auto;
  background:#ecfdf3;
  color:#047857;
  border:1px solid #bbf7d0;
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
}
.customer-meta{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  margin-bottom:14px;
}
.customer-meta div{
  display:flex;justify-content:space-between;gap:10px;
  background:#f8fafc;border-radius:12px;padding:10px 12px;
}
.customer-meta span{color:#667085}
.customer-meta strong{font-weight:800;text-align:right}
.customer-note{
  color:#475467;
  background:#fff;
  border:1px dashed #d8e0ec;
  border-radius:14px;
  padding:12px;
  min-height:70px;
  line-height:1.6;
}
.customer-actions{
  display:flex;gap:10px;margin-top:14px;
}
.customer-actions a{
  flex:1;text-align:center;text-decoration:none;
  background:#f2f6ff;color:#1d4ed8;
  border-radius:12px;padding:10px;font-weight:900;
}
.form-grid{
  display:grid;
  gap:12px;
}
.form-grid label{
  font-weight:850;
  color:#344054;
}
.form-grid input,.form-grid select,.form-grid textarea{
  width:100%;
  border:1px solid #d8e0ec;
  border-radius:12px;
  padding:12px 14px;
  font-size:15px;
  outline:none;
  background:#fff;
}
@media(max-width:1200px){
  .customer-grid{grid-template-columns:repeat(2,1fr)}
  .pipeline{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:760px){
  .customer-grid{grid-template-columns:1fr}
}


/* V20 bugfix polish */
.user-menu{position:relative}
.user-button{
  display:flex;align-items:center;gap:8px;
  border:0;background:#fff;color:#101828;
  font-weight:850;cursor:pointer;border-radius:999px;
  padding:8px 12px;
}
.user-avatar{
  width:32px;height:32px;border-radius:50%;
  background:#eef4ff;display:inline-flex;align-items:center;justify-content:center;
}
.user-dropdown{
  display:none;position:absolute;right:0;top:44px;
  min-width:150px;background:#fff;border:1px solid #e7edf6;
  box-shadow:0 14px 36px rgba(15,35,65,.14);
  border-radius:14px;padding:8px;z-index:50;
}
.user-dropdown a{
  display:block;text-decoration:none;color:#344054;
  padding:10px 12px;border-radius:10px;font-weight:800;
}
.user-dropdown a:hover{background:#f2f6ff;color:#1d4ed8}
.user-menu:hover .user-dropdown{display:block}
.crm-toolbar a.active{
  background:#2563eb;color:#fff;border-color:#2563eb;
}
.reminder-summary{
  display:grid;grid-template-columns:repeat(3,1fr);
  gap:16px;margin-bottom:20px;
}
.summary-card{
  background:#fff;border:1px solid #e7edf6;border-radius:20px;
  padding:22px;box-shadow:0 12px 30px rgba(15,35,65,.06);
}
.summary-card strong{
  display:block;font-size:28px;margin-bottom:6px;color:#101828;
}
.summary-card span{color:#667085;font-weight:700}
.auth-body{
  min-height:100vh;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,#eef4ff,#f8fafc);
}
.auth-card{
  width:420px;background:#fff;border:1px solid #e7edf6;border-radius:24px;
  box-shadow:0 18px 50px rgba(15,35,65,.12);padding:34px;
}
.auth-brand{font-size:22px;font-weight:900;color:#2563eb;margin-bottom:20px}
.auth-card h1{margin:0 0 8px;font-size:30px}
.auth-card p{margin:0 0 22px;color:#667085}
.auth-form{display:grid;gap:12px}
.auth-form label{font-weight:850;color:#344054}
.auth-form input{
  border:1px solid #d8e0ec;border-radius:12px;
  padding:13px 14px;font-size:15px;
}
.auth-footer{margin-top:18px;text-align:center}
.auth-footer a{color:#2563eb;text-decoration:none;font-weight:850}
@media(max-width:900px){
  .reminder-summary{grid-template-columns:1fr}
}


/* V21 permissions avatar delete */
.user-avatar-img{
  width:32px;
  height:32px;
  border-radius:50%;
  object-fit:cover;
  display:inline-block;
}
.customer-actions form{
  flex:1;
  margin:0;
}
.danger-btn{
  width:100%;
  border:0;
  background:#fff1f2;
  color:#be123c;
  border-radius:12px;
  padding:10px;
  font-weight:900;
  cursor:pointer;
}
.danger-btn:hover{
  background:#ffe4e6;
}
.profile-preview{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:18px;
  padding:16px;
  background:#f8fafc;
  border:1px solid #e7edf6;
  border-radius:18px;
}
.profile-preview img,
.profile-preview div{
  width:64px;
  height:64px;
  border-radius:50%;
  object-fit:cover;
  background:#eef4ff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:30px;
}
.profile-preview span{
  font-size:20px;
  font-weight:900;
}

.profile-preview img{border:2px solid #e7edf6}
.muted{color:#667085}


/* V22 Customer Enhanced */
.tag-row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.tag-row span{
  background:#eef4ff;
  color:#1d4ed8;
  border:1px solid #dbeafe;
  border-radius:999px;
  padding:5px 9px;
  font-size:12px;
  font-weight:900;
}
.form-2col{
  grid-template-columns:repeat(2,minmax(0,1fr));
}
.form-2col .full{
  grid-column:1 / -1;
}
.detail-list{
  display:grid;
  gap:10px;
}
.detail-list div{
  display:flex;
  justify-content:space-between;
  gap:14px;
  padding:13px 14px;
  background:#f8fafc;
  border:1px solid #edf1f7;
  border-radius:14px;
}
.detail-list span{color:#667085;font-weight:700}
.detail-list strong{text-align:right}
@media(max-width:800px){
  .form-2col{grid-template-columns:1fr}
}


/* V23 Dashboard + User Management UI */
.brand-mark{
  display:inline-flex;
  width:36px;height:36px;
  align-items:center;justify-content:center;
  border-radius:12px;
  background:#2563eb;
  color:#fff;
  margin-right:8px;
  font-size:13px;
}
.app-brand{
  display:flex;
  align-items:center;
  gap:4px;
}
.stat-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:18px;
  margin-bottom:22px;
}
.stat-card{
  display:flex;
  gap:16px;
  align-items:center;
  text-decoration:none;
  color:inherit;
  background:#fff;
  border:1px solid #e7edf6;
  border-radius:22px;
  padding:22px;
  box-shadow:0 12px 30px rgba(15,35,65,.06);
}
.stat-icon{
  width:54px;height:54px;border-radius:18px;
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-size:22px;font-weight:900;
}
.stat-card span{
  color:#667085;
  font-weight:800;
}
.stat-card strong{
  display:block;
  font-size:32px;
  margin-top:4px;
}
.wide-left{
  grid-template-columns:1.15fr .85fr;
}
.stage-board{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
  margin-bottom:20px;
}
.stage-card{
  background:#f8fafc;
  border:1px solid #e7edf6;
  border-radius:16px;
  padding:16px;
}
.stage-card strong{
  display:block;
  font-size:26px;
  margin-bottom:6px;
}
.stage-card span{
  color:#667085;
  font-weight:750;
}
.progress-list{
  display:grid;
  gap:14px;
}
.progress-list > div{
  display:grid;
  grid-template-columns:80px 1fr 40px;
  gap:12px;
  align-items:center;
}
.progress-list label{
  font-weight:850;
  color:#344054;
}
.progress{
  height:10px;
  background:#eef2f7;
  border-radius:999px;
  overflow:hidden;
}
.progress i{
  display:block;
  height:100%;
  background:#2563eb;
  border-radius:999px;
}
.orange-bar i{background:#f97316}
.green-bar i{background:#10b981}
.mini-row{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:center;
  border-bottom:1px solid #edf1f7;
  padding:14px 0;
}
.mini-row:last-child{border-bottom:0}
.mini-row p{
  margin:4px 0 0;
  color:#667085;
}
.date-pill{
  background:#f2f6ff;
  color:#1d4ed8;
  border-radius:999px;
  padding:6px 10px;
  font-weight:900;
  white-space:nowrap;
}
.mini-action{
  text-decoration:none;
  color:#2563eb;
  font-weight:900;
}
.quick-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}
.quick-grid a{
  text-decoration:none;
  background:#f2f6ff;
  color:#1d4ed8;
  padding:16px;
  border-radius:16px;
  font-weight:900;
  text-align:center;
}
.user-cell{
  display:flex;
  align-items:center;
  gap:12px;
}
.user-cell img,
.user-cell span{
  width:44px;height:44px;border-radius:50%;
  object-fit:cover;
  background:#eef4ff;
  display:flex;align-items:center;justify-content:center;
  font-size:22px;
}
.user-cell p{
  margin:4px 0 0;
  color:#667085;
  font-size:13px;
}
.role-pill{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  background:#f2f4f7;
  color:#344054;
  font-weight:900;
}
.admin-role{
  background:#eef4ff;
  color:#1d4ed8;
}
.user-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.user-actions form{
  margin:0;
}
.user-actions button{
  border:0;
  background:#f2f6ff;
  color:#1d4ed8;
  padding:8px 10px;
  border-radius:10px;
  font-weight:900;
  cursor:pointer;
}
.user-actions .danger-mini{
  background:#fff1f2;
  color:#be123c;
}
@media(max-width:1200px){
  .stat-grid{grid-template-columns:repeat(2,1fr)}
  .stage-board{grid-template-columns:repeat(2,1fr)}
  .wide-left{grid-template-columns:1fr}
}


/* V24 Follow Logs */
.timeline{
  position:relative;
  display:grid;
  gap:16px;
}
.timeline-item{
  display:grid;
  grid-template-columns:18px 1fr;
  gap:12px;
}
.timeline-dot{
  width:12px;
  height:12px;
  background:#2563eb;
  border-radius:999px;
  margin-top:18px;
  box-shadow:0 0 0 5px #eef4ff;
}
.timeline-card{
  border:1px solid #e7edf6;
  background:#fbfcff;
  border-radius:18px;
  padding:16px;
}
.timeline-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.timeline-head strong{
  font-size:16px;
}
.timeline-head span{
  color:#667085;
  font-size:13px;
}
.timeline-card p{
  color:#344054;
  line-height:1.7;
  white-space:pre-wrap;
  margin:0 0 10px;
}
.next-action{
  background:#fff7ed;
  color:#9a3412;
  border:1px solid #fed7aa;
  border-radius:12px;
  padding:10px 12px;
  margin:10px 0;
  font-weight:800;
}
.timeline-user{
  color:#667085;
  font-size:13px;
  margin-top:10px;
}
.danger-link{
  margin-top:10px;
  border:0;
  background:transparent;
  color:#be123c;
  font-weight:900;
  cursor:pointer;
  padding:0;
}


/* V25 DingTalk Reminder */
.version-badge{
  position:absolute;
  left:18px;
  bottom:18px;
  color:#8fb1dc;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  padding:8px 10px;
  font-size:12px;
  font-weight:800;
}
.back-btn{
  border:0;
  background:#f2f6ff;
  color:#1d4ed8;
  border-radius:12px;
  padding:10px 14px;
  font-weight:900;
  cursor:pointer;
  margin-right:12px;
}
.app-topbar{
  gap:12px;
}
.header-actions{
  display:flex;
  gap:12px;
  align-items:center;
}
.header-actions form{
  margin:0;
}
.btn-secondary{
  border:0;
  background:#f2f6ff;
  color:#1d4ed8;
  border-radius:12px;
  padding:12px 18px;
  font-weight:900;
  cursor:pointer;
}
.success-notice{
  background:#ecfdf3 !important;
  color:#047857 !important;
  border-color:#bbf7d0 !important;
}


/* V27.5 Auto Reminder */
.setting-actions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-top:12px;
}
.setting-actions form{margin:0}
.rule-box{
  background:#f8fafc;
  border:1px solid #e7edf6;
  border-radius:16px;
  padding:14px;
  margin-bottom:12px;
}
.rule-box strong{display:block;margin-bottom:6px}
.rule-box p{margin:0;color:#667085;line-height:1.6}
.setting-switch{margin-top:14px}
.version-badge{font-size:12px}


/* V28 Reminder Template System */
.template-editor{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height:1.7;
}
.template-help{
  color:#667085;
  line-height:1.8;
}
.template-help span{
  display:inline-block;
  background:#eef4ff;
  color:#1d4ed8;
  border-radius:8px;
  padding:3px 7px;
  margin:3px;
  font-weight:900;
}
.template-preview{
  white-space:pre-wrap;
  background:#f8fafc;
  border:1px solid #e7edf6;
  border-radius:16px;
  padding:18px;
  line-height:1.8;
  font-size:15px;
}
