:root {
  --ink: #191923;
  --muted: #63636f;
  --line: #dfdfe8;
  --page: #f6f7fb;
  --panel: #ffffff;
  --purple: #6e40c9;
  --purple-dark: #4b2a91;
  --blue: #1668dc;
  --green: #138a5b;
  --amber: #b76b00;
  --red: #c23b3b;
  --shadow: 0 10px 30px rgba(24, 24, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(25, 25, 35, 0.82), rgba(25, 25, 35, 0.24)),
    url("https://images.unsplash.com/photo-1552664730-d307ca884978?auto=format&fit=crop&w=1800&q=80") center / cover;
}

.login-panel {
  min-height: 100vh;
  background: rgba(255, 255, 255, 0.96);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  min-width: 0;
}

.brand-login {
  align-items: flex-start;
}

.brand-logo-wrap {
  width: 184px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff, #f7f4ff 58%, #eee7ff);
  border: 1px solid rgba(110, 64, 201, 0.18);
  box-shadow: 0 10px 24px rgba(75, 42, 145, 0.14);
  flex: 0 0 auto;
}

.brand-logo-wrap-large {
  width: min(100%, 320px);
  height: 84px;
  border-radius: 8px;
}

.brand-logo {
  width: 92%;
  height: 82%;
  object-fit: contain;
  display: block;
}

.login-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.primary,
.secondary,
.ghost,
.nav-item {
  border: 0;
  border-radius: 8px;
  min-height: 38px;
  padding: 9px 13px;
  font-weight: 800;
}

.primary {
  color: white;
  background: var(--purple);
}

.primary:hover {
  background: var(--purple-dark);
}

.dingtalk-login {
  width: 100%;
  min-height: 46px;
}

.mock-login-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfbfe;
}

.mock-login-box summary {
  cursor: pointer;
  font-weight: 800;
  margin-bottom: 12px;
}

.secondary {
  color: var(--purple-dark);
  background: #eee8ff;
}

.ghost {
  color: var(--ink);
  background: #f0f1f5;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr);
}

.topbar {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.search {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 38px;
  padding: 0 12px;
}

.role-pill,
.status-pill,
.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.role-pill {
  background: #eef4ff;
  color: var(--blue);
}

.status-pill {
  background: #e9f7f0;
  color: var(--green);
}

.current-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  max-width: 280px;
}

.current-user strong,
.current-user span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-user strong {
  font-size: 13px;
}

.current-user span {
  color: var(--muted);
  font-size: 12px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  object-fit: cover;
}

.user-avatar-fallback {
  background: #eef4ff;
  color: var(--blue);
  font-weight: 900;
}

.risk-pill {
  background: #fff2df;
  color: var(--amber);
}

.risk-high {
  background: #ffe9e9;
  color: var(--red);
}

.sidebar {
  background: #20202b;
  color: white;
  padding: 18px 12px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-item {
  width: 100%;
  text-align: left;
  color: #f7f7fb;
  background: transparent;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.content {
  padding: 22px;
  overflow: auto;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.compact-head {
  align-items: center;
  margin-bottom: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 28px;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.card {
  padding: 14px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.compact-kpis {
  grid-template-columns: repeat(3, minmax(120px, 1fr));
}

.crm-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) minmax(140px, 180px);
  gap: 12px;
  margin-bottom: 16px;
  box-shadow: none;
}

.subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.subnav-item {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 10px 12px;
  white-space: nowrap;
}

.subnav-item.active,
.subnav-item:hover {
  color: var(--ink);
  border-bottom-color: var(--purple);
}

.inline-button {
  min-height: 28px;
  margin-left: 8px;
  padding: 4px 9px;
}

.kpi {
  border-left: 4px solid var(--purple);
  background: #fbfbfe;
  padding: 12px;
  border-radius: 6px;
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.list {
  display: grid;
  gap: 8px;
}

.list-button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  text-align: left;
}

.list-button:hover {
  border-color: var(--purple);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.click-row {
  cursor: pointer;
}

.click-row:hover {
  background: #f8f5ff;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 16px;
}

.timeline-item {
  display: grid;
  grid-template-columns: minmax(92px, 120px) minmax(0, 1fr);
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item p {
  overflow-wrap: anywhere;
}

.timeline-item:last-child {
  border-bottom: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.timeline-input-panel {
  margin-top: 16px;
}

.draft-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff2df;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.coach-card {
  border: 1px solid #cfe0ff;
  background: #f7fbff;
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0 12px;
}

.weak-panel {
  opacity: 0.72;
}

.group-binding-panel {
  margin-top: 16px;
}

.dev-test-panel,
.target-editor {
  margin-bottom: 16px;
}

.dev-test-panel summary {
  cursor: pointer;
  font-weight: 800;
}

.dev-test-body {
  margin-top: 14px;
}

.compact-layout {
  grid-template-columns: minmax(300px, 0.55fr) minmax(0, 1fr);
}

.binding-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  box-shadow: none;
}

.large-textarea {
  min-height: 210px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #20202b;
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  max-width: min(420px, calc(100vw - 36px));
}

.error {
  color: var(--red);
  font-weight: 800;
  min-height: 20px;
}

@media (max-width: 920px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .topbar,
  .sidebar {
    grid-column: 1;
  }

  .sidebar {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .nav-item {
    white-space: nowrap;
  }

  .grid.two,
  .grid.three,
  .detail-layout,
  .crm-controls,
  .kpis {
    grid-template-columns: 1fr;
  }
}
