/* ============ DingTalk integration ============ */
.dingtalk-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 23px 25px; border-radius: 18px; color: #fff; margin-bottom: 13px;
  background: radial-gradient(520px 300px at 90% -20%, rgba(76, 188, 255, 0.5), transparent 62%), linear-gradient(125deg, #063276 0%, #0757b8 55%, #1089e8 100%);
  box-shadow: 0 13px 30px rgba(10, 82, 174, 0.2);
}
.dingtalk-hero::after {
  content: ""; position: absolute; right: -75px; top: -120px; width: 320px; height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.13); border-radius: 50%;
  box-shadow: 0 0 0 48px rgba(255, 255, 255, 0.03), 0 0 0 100px rgba(255, 255, 255, 0.02);
}
.dingtalk-hero-main { position: relative; z-index: 1; display: flex; gap: 15px; align-items: flex-start; }
.dingtalk-logo {
  width: 49px; height: 49px; border-radius: 14px; background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2); display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px); flex: 0 0 auto;
}
.dingtalk-eyebrow { font-size: 9px; letter-spacing: 1.4px; color: rgba(255, 255, 255, 0.53); font-weight: 600; }
.dingtalk-hero h2 { margin-top: 6px; font-size: 20px; letter-spacing: -0.3px; font-weight: 650; }
.dingtalk-hero p { max-width: 580px; margin-top: 6px; font-size: 11px; line-height: 1.65; color: rgba(255, 255, 255, 0.6); }
.dingtalk-hero-side { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; flex: 0 0 auto; }
.dingtalk-status-chips { display: flex; gap: 6px; align-items: center; }
.dingtalk-hero .status-badge.green { background: rgba(85, 223, 171, 0.16); color: #8af0c9; }
.dingtalk-hero .status-badge.gray { background: rgba(255, 255, 255, 0.13); color: rgba(255, 255, 255, 0.75); }
.dingtalk-hero .soft-chip { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.72); }
.dingtalk-hero-actions { display: flex; gap: 7px; }
.dingtalk-hero .btn-glass { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); color: #fff; }
.dingtalk-hero .btn-glass:hover { background: rgba(255, 255, 255, 0.18); }

.dingtalk-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 14px; }
.dingtalk-stat { padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-xs); }
.dingtalk-stat span { display: block; font-size: 9.5px; color: var(--muted); }
.dingtalk-stat strong { display: block; margin-top: 6px; font-family: var(--font-number); font-size: 18px; letter-spacing: -0.3px; }
.dingtalk-stat strong small { font-family: var(--font); font-size: 9px; color: var(--muted); font-weight: 500; }
.dingtalk-stat small { display: block; margin-top: 4px; font-size: 8.5px; color: var(--muted-2); }
.dingtalk-enable-row { padding-top: 0; border-bottom: 0; }
.advanced-box { margin-top: 17px; padding: 11px 13px; background: #fafcff; border: 1px solid #eef3fa; border-radius: 9px; }
.advanced-box summary { cursor: pointer; font-size: 10.5px; font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 5px; }
.advanced-box summary::-webkit-details-marker { display: none; }
.advanced-box summary::before { content: "+"; width: 15px; height: 15px; border-radius: 4px; background: #eaf4ff; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.advanced-box[open] summary::before { content: "−"; }
.settings-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.binding-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.binding-summary strong { font-family: var(--font-number); font-size: 27px; font-weight: 650; letter-spacing: -0.5px; }
.binding-summary span { font-size: 10px; color: var(--muted); }
.binding-progress { margin-top: 10px; }
.binding-list { margin-top: 13px; border-top: 1px solid #f2f5f9; }
.binding-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid #f5f7fa; font-size: 10px; color: var(--muted); }
.binding-row:last-child { border-bottom: 0; }
.binding-row strong { margin-left: auto; font-size: 10px; color: var(--ink-2); }
.binding-dot { width: 6px; height: 6px; border-radius: 50%; }
.binding-dot.green { background: #13b57e; }
.binding-dot.orange { background: #f0a12a; }

.dingtalk-mini-phone { max-width: 290px; margin: 0 auto; border: 1px solid #e6edf6; border-radius: 16px; background: #f7f9fc; padding: 8px; box-shadow: 0 10px 25px rgba(21, 45, 80, 0.06); }
.mini-phone-bar { display: flex; justify-content: space-between; padding: 1px 5px 7px; font-size: 8px; color: #7f8da1; }
.mini-phone-body { background: #eef2f8; border-radius: 11px; padding: 12px 9px; }
.mini-msg { display: flex; align-items: flex-start; gap: 7px; }
.mini-msg-icon { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(145deg, #2d8aff, #1265da); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.mini-sender { font-size: 8px; color: #7d8ba0; margin-bottom: 4px; }
.mini-sender span { color: #a4b0c0; margin-left: 3px; }
.mini-card { background: #fff; border-radius: 8px; padding: 9px 10px; box-shadow: 0 2px 5px rgba(25, 45, 75, 0.05); }
.mini-card strong { display: block; font-size: 9.5px; color: #2b3b51; }
.mini-card p { margin-top: 5px; font-size: 8px; line-height: 1.55; color: #63738a; }
.mini-card p b { color: #0d6edf; font-family: var(--font-number); }
.mini-card-btns { display: flex; gap: 4px; margin-top: 8px; padding-top: 7px; border-top: 1px solid #f1f4f8; }
.mini-card-btns span { flex: 1; text-align: center; padding: 4px 0; border-radius: 4px; background: #eef6ff; color: #1677ff; font-size: 7.5px; font-weight: 600; }
.mini-card-btns span:last-child { background: #f4f7fb; color: #6e7e93; }

.dingtalk-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.dingtalk-step { display: flex; gap: 9px; padding: 12px; border: 1px solid #eef2f8; border-radius: 10px; background: #fbfcfe; }
.dingtalk-step > span { font-family: var(--font-number); font-size: 11px; font-weight: 700; color: var(--brand); opacity: 0.7; }
.dingtalk-step strong { display: block; font-size: 10px; font-weight: 650; color: var(--ink-2); }
.dingtalk-step p { margin-top: 4px; font-size: 8.5px; line-height: 1.55; color: var(--muted); }

.dingtalk-notify-card {
  display: flex; align-items: center; gap: 13px; padding: 13px 16px; margin-bottom: 16px;
  background: linear-gradient(110deg, #f8fbff, #f2f8ff); border: 1px solid #dfeafb; border-radius: 12px;
}
.dingtalk-notify-card.is-pending { background: #fcfdff; border-color: var(--line); }
.dingtalk-notify-icon { width: 36px; height: 36px; border-radius: 10px; background: #eaf4ff; color: #1677ff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.dingtalk-notify-main { flex: 1; min-width: 0; }
.dingtalk-notify-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.dingtalk-notify-title strong { font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.dingtalk-notify-main p { margin-top: 4px; font-size: 10px; line-height: 1.55; color: var(--muted); }
.dingtalk-notify-time { display: block; margin-top: 4px; font-size: 8.5px; color: var(--muted-2); }
.dingtalk-notify-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.dingtalk-log-list { display: flex; flex-direction: column; }
.dingtalk-log-row { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid #f3f6fa; }
.dingtalk-log-row:last-child { border-bottom: 0; }
.dingtalk-log-dot { width: 22px; height: 22px; border-radius: 7px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.dingtalk-log-dot.sent { background: var(--green-soft); color: var(--green); }
.dingtalk-log-dot.failed { background: var(--red-soft); color: var(--red); }
.dingtalk-log-main { flex: 1; min-width: 0; }
.dingtalk-log-main strong { display: block; font-size: 10.5px; font-weight: 600; }
.dingtalk-log-main span { display: block; margin-top: 2px; font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dingtalk-log-time { font-size: 9px; color: var(--muted-2); }

.dingtalk-bound, .dingtalk-unbound { display: inline-flex; align-items: center; gap: 2px; }
.dingtalk-bound { color: #0e8d64; }
.dingtalk-unbound { color: #d48722; }
.employee-meta .icon { display: inline-block; vertical-align: -1px; }

/* ============ Chat / feedback dialog ============ */
.chat-source {
  display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px; border-radius: 5px;
  background: #f2f5f9; color: #7d8b9f; font-size: 8.5px; font-weight: 600; white-space: nowrap;
}
.chat-source.dingtalk { background: #eaf4ff; color: #1677ff; }
.feedback-card-actions { display: flex; gap: 7px; align-items: center; }
.feedback-mini-actions { display: flex; gap: 5px; align-items: center; }
.feedback-chat-link { margin-top: 6px; font-size: 9.5px; }
.feedback-chat-drawer .drawer-body { padding: 14px 16px 10px; display: flex; flex-direction: column; }
.chat-context {
  display: flex; align-items: center; gap: 10px; padding: 12px 13px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff;
}
.chat-context-main { flex: 1; min-width: 0; }
.chat-context-main strong { display: block; font-size: 12px; font-weight: 650; }
.chat-context-main span { display: block; margin-top: 3px; font-size: 9px; color: var(--muted); }
.chat-context-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.chat-amount-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 9px 0 10px;
  background: #f8fafd; border-radius: 8px; font-size: 9px; color: var(--muted);
}
.chat-amount-bar strong { font-family: var(--font-number); font-size: 11px; color: var(--ink-2); }
.chat-category { margin-left: auto; color: var(--brand); font-weight: 600; }
.chat-thread { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 7px 2px 17px; min-height: 220px; }
.chat-day { align-self: center; padding: 3px 8px; border-radius: 10px; background: #eef2f7; color: #94a1b2; font-size: 8.5px; margin: 3px 0 5px; }
.chat-row { display: flex; align-items: flex-start; gap: 8px; max-width: 88%; }
.chat-row.is-mine { flex-direction: row-reverse; align-self: flex-end; }
.chat-message { min-width: 0; }
.chat-meta { display: flex; align-items: center; gap: 7px; margin: 0 3px 4px; font-size: 8.5px; color: var(--muted-2); }
.chat-row.is-mine .chat-meta { justify-content: flex-end; }
.chat-meta span { font-weight: 600; color: var(--muted); }
.chat-meta time { font-family: var(--font-number); font-size: 8px; }
.chat-bubble {
  padding: 10px 12px; border-radius: 4px 12px 12px 12px; background: #fff; border: 1px solid #e9eef6;
  font-size: 11px; line-height: 1.7; color: #46566c; box-shadow: 0 2px 7px rgba(25, 45, 75, 0.035);
  word-break: break-word;
}
.chat-row.is-mine .chat-bubble { border-radius: 12px 4px 12px 12px; background: #1677ff; border-color: #1677ff; color: #fff; }
.chat-empty { flex: 1; min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #a6b2c2; font-size: 10px; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; width: 100%; }
.chat-input {
  flex: 1; min-height: 42px; max-height: 100px; padding: 10px 11px; resize: none;
  border: 1px solid var(--line-strong); border-radius: 10px; outline: none; font-size: 11px; line-height: 1.5;
  color: var(--ink-2); background: #fff;
}
.chat-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.09); }
.chat-send { height: 42px; flex: 0 0 auto; padding: 0 14px; border-radius: 10px; font-size: 11px; }
.feedback-chat-drawer .drawer-footer { padding: 10px 14px 12px; }

/* ============ Phone preview modal ============ */
.dingtalk-preview-layout { display: grid; grid-template-columns: 278px minmax(0, 1fr); gap: 22px; align-items: start; }
.dingtalk-phone {
  width: 278px; border-radius: 27px; background: #101e32; padding: 8px;
  box-shadow: 0 18px 38px rgba(19, 39, 68, 0.2);
}
.phone-statusbar { display: flex; justify-content: space-between; padding: 2px 11px 5px; color: rgba(255, 255, 255, 0.7); font-size: 7px; }
.phone-appbar { display: flex; align-items: center; justify-content: space-between; padding: 4px 10px 8px; color: #fff; }
.phone-appbar strong { font-size: 11px; font-weight: 600; }
.phone-back, .phone-more { color: rgba(255, 255, 255, 0.7); font-size: 13px; }
.phone-chat-head { display: flex; align-items: center; gap: 5px; padding: 7px 10px; background: #fff; color: #6f7f94; font-size: 8px; border-radius: 12px 12px 0 0; }
.phone-chat-body { min-height: 370px; padding: 13px 9px; background: #eef2f8; border-radius: 0 0 19px 19px; }
.phone-timestamp { text-align: center; font-size: 7px; color: #9ba7b7; margin-bottom: 11px; }
.phone-message-row { display: flex; gap: 6px; align-items: flex-start; }
.phone-app-avatar { width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(145deg, #2d8aff, #1265da); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.phone-message { flex: 1; min-width: 0; }
.phone-sender { font-size: 7.5px; color: #7c8b9e; margin: 2px 0 5px; }
.phone-sender span { color: #a5b0bf; margin-left: 3px; }
.dingtalk-card { background: #fff; border-radius: 9px; padding: 11px 11px 7px; box-shadow: 0 3px 8px rgba(25, 45, 75, 0.06); }
.dingtalk-card-title { font-size: 10.5px; font-weight: 700; color: #24364e; }
.dingtalk-card-markdown { margin-top: 6px; font-size: 8px; line-height: 1.65; color: #5d6d83; }
.dingtalk-card-markdown strong { color: #1677ff; font-family: var(--font-number); }
.dingtalk-card-actions { display: flex; gap: 5px; margin-top: 11px; }
.dingtalk-card-actions button { flex: 1; border: 1px solid #e5ecf5; background: #f8fafd; color: #6c7c91; border-radius: 5px; padding: 5px 0; font-size: 7.5px; font-weight: 600; }
.dingtalk-card-actions button.primary { background: #eaf4ff; border-color: #d2e7ff; color: #1677ff; }
.dingtalk-card-brand { margin-top: 8px; padding-top: 6px; border-top: 1px solid #f2f5f9; display: flex; align-items: center; gap: 3px; color: #b1bdca; font-size: 6.5px; }
.dingtalk-preview-side { padding-top: 3px; }
.preview-side-label { margin: 14px 0 7px; font-size: 9px; font-weight: 700; letter-spacing: 0.6px; color: #96a3b5; }
.preview-side-label:first-child { margin-top: 0; }
.preview-employee { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; }
.preview-employee strong { display: block; font-size: 10.5px; }
.preview-employee span { display: block; margin-top: 2px; font-size: 8.5px; color: var(--muted-2); }
.preview-info-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f3f6fa; font-size: 9.5px; }
.preview-info-row span { color: var(--muted); }
.preview-info-row strong { color: var(--ink-2); font-weight: 600; }
.dingtalk-preview-side .btn-block { margin-bottom: 6px; }
.dingtalk-preview-side .callout { font-size: 8.5px; }

@media (max-width: 860px) {
  .dingtalk-hero { flex-direction: column; align-items: flex-start; }
  .dingtalk-hero-side { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
  .dingtalk-stats { grid-template-columns: 1fr 1fr; }
  .settings-two-col { grid-template-columns: 1fr; }
  .dingtalk-steps { grid-template-columns: 1fr 1fr; }
  .dingtalk-preview-layout { grid-template-columns: 1fr; justify-items: center; }
  .dingtalk-preview-side { width: 100%; max-width: 380px; }
}
@media (max-width: 560px) {
  .dingtalk-stats { grid-template-columns: 1fr; }
  .dingtalk-steps { grid-template-columns: 1fr; }
  .dingtalk-notify-card { align-items: flex-start; flex-wrap: wrap; }
  .dingtalk-notify-actions { width: 100%; margin-left: 49px; }
  .chat-row { max-width: 94%; }
  .settings-two-col { gap: 12px; }
}
