:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #dfe7f2;
  --line-strong: #c9d6e7;
  --text: #162033;
  --muted: #66758b;
  --blue: #2563eb;
  --blue-soft: #eef4ff;
  --blue-strong: #174fc7;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #dc2626;
  --purple: #8b5cf6;
  --gray: #6b7280;
  --sidebar: #ffffff;
  --sidebar-2: #f7f9fc;
  --shadow: 0 10px 28px rgba(15, 23, 42, .07);
  --shadow-strong: 0 16px 34px rgba(37, 99, 235, .12);
  --radius-card: 16px;
  --radius-pill: 999px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background:
  radial-gradient(circle at top right, rgba(37,99,235,.06), transparent 24%),
  radial-gradient(circle at 10% 0%, rgba(22,163,74,.04), transparent 20%),
  var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow: auto; padding: 18px 12px; color: #334155; background: linear-gradient(180deg, #ffffff, #f8fafc); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; color: #0f172a; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #2563eb, #174fc7); color: #fff; font-weight: 900; box-shadow: 0 8px 18px rgba(37, 99, 235, .28); }
.brand strong { display: block; font-size: 20px; line-height: 1; }
.brand small { display: block; margin-top: 5px; font-size: 11px; color: #64748b; }
.nav-stack { display: grid; gap: 6px; }
.nav-stack a { display: flex; align-items: center; gap: 11px; border-radius: 12px; padding: 10px 11px; color: #334155; font-weight: 650; border: 1px solid transparent; transition: all .15s ease; }
.nav-stack a:hover { border-color: #d8e2f1; background: #f8fbff; color: #1e293b; }
.nav-stack a.active { background: linear-gradient(135deg, #2563eb, #174fc7); color: #fff; box-shadow: 0 10px 20px rgba(37, 99, 235, .24); }
.nav-stack span { width: 18px; text-align: center; opacity: .95; }
.operator-card { position: absolute; left: 12px; right: 12px; bottom: 14px; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 18px rgba(15, 23, 42, .04); }
.avatar { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; background: linear-gradient(135deg, #60a5fa, #16a34a); color: #fff; font-weight: 800; }
.avatar.mini { width: 28px; height: 28px; font-size: 12px; }
.operator-card strong { display: block; color: #0f172a; }
.operator-card small { color: #64748b; }
.content { min-width: 0; padding: 0 24px 24px; }
.topbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr minmax(320px, 520px) auto; align-items: center; gap: 18px; min-height: 68px; background: rgba(244,247,251,.9); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.runtime-strip {
  position: sticky;
  top: 68px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 8px 0;
  background: rgba(247, 250, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #dde7f6;
}
.runtime-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #d9e4f4;
  color: #5e7392;
  background: #f4f8ff;
  font-size: 12px;
  font-weight: 800;
}
.runtime-chip.state-running {
  border-color: #bde8cd;
  color: #116a38;
  background: #e9fbf0;
}
.runtime-chip.state-stopped {
  border-color: #d6dee9;
  color: #516178;
  background: #f3f6fb;
}
.runtime-chip.state-error {
  border-color: #ffd3d0;
  color: #b42318;
  background: #fff1f0;
}
.runtime-chip.state-starting {
  border-color: #f9d18d;
  color: #b45309;
  background: #fff7e8;
}
.runtime-chip.state-stopping {
  border-color: #fdc9a3;
  color: #c2410c;
  background: #fff2e8;
}
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: #fff; cursor: pointer; box-shadow: 0 4px 12px rgba(15,23,42,.04); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu strong { display: block; font-size: 12px; line-height: 1.1; }
.user-menu small { display: block; color: var(--muted); font-size: 11px; }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 10px); z-index: 20; min-width: 190px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.user-dropdown a { display: block; padding: 9px 10px; border-radius: 8px; color: #334155; font-weight: 700; }
.user-dropdown a:hover { background: #f1f5f9; color: var(--blue); }
.danger-link { color: var(--red) !important; }
.global-search { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; border: 1px solid #d6e0f0; border-radius: var(--radius-pill); background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .03); }
.global-search span { color: #64748b; }
.global-search input { border: 0; outline: 0; width: 100%; font-size: 13px; background: transparent; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); display: inline-grid; place-items: center; background: #fff; color: #334155; transition: all .14s ease; }
.icon-btn:hover { border-color: var(--line-strong); background: #f8fbff; box-shadow: 0 6px 16px rgba(15,23,42,.05); }
.icon-btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.icon-btn:disabled { opacity: .7; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 20px 0; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 850; letter-spacing: 0; color: #12233e; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-weight: 800; font-size: 12px; letter-spacing: 0; }
.quick-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.btn { border-radius: 10px; font-weight: 700; font-size: 13px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; transition: all .14s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 18px rgba(15,23,42,.08); }
.btn-primary { background: var(--blue); border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-strong); border-color: var(--blue-strong); }
.btn-soft { background: #fff; border: 1px solid var(--line); color: #334155; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.card-shell, .panel, .metric-card, .work-card, .kanban-col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: 0 4px 14px rgba(15,23,42,.05); }
.hero-kpis { margin-bottom: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-height: 92px; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; transition: .15s ease; border-radius: 16px; }
.metric-card:hover, .work-card:hover, .kanban-card:hover, .list-table a:hover, .order-row:hover { transform: translateY(-1px); box-shadow: var(--shadow-strong); }
.metric-card span, .work-card span, .summary-grid span, .metric span { color: var(--muted); font-size: 13px; }
.metric-card strong, .work-card strong, .metric strong { display: block; margin-top: 4px; font-size: 26px; line-height: 1; }
.metric-card small { color: var(--green); font-weight: 800; }
.metric-card i { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-style: normal; font-size: 15px; }
.card-shell { padding: 18px; margin-bottom: 12px; }
.card-title, .workspace-header, .section-title, .action-top, .kanban-title, .module-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-title h2, .panel h2 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: 0; color: #13253f; }
.page-subtitle { margin: 6px 0 0; color: #617a9e; font-size: 14px; }
.card-title small { color: var(--muted); font-weight: 600; }
.card-title a, .link-action { color: var(--blue); font-weight: 750; font-size: 13px; }
.priority-board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.work-card { padding: 16px; display: grid; gap: 8px; }
.work-card small { border: 1px solid #bfd7ff; color: var(--blue); border-radius: 999px; text-align: center; padding: 6px 10px; font-weight: 750; background: #f7faff; }
.work-card.blue { border-top: 3px solid var(--blue); }
.work-card.orange { border-top: 3px solid var(--orange); }
.work-card.red { border-top: 3px solid var(--red); }
.work-card.green { border-top: 3px solid var(--green); }
.work-card.purple { border-top: 3px solid var(--purple); }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 14px; }
.action-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.action-card { display: grid; gap: 7px; padding: 14px; background: #fff; border: 1px solid var(--line); border-left: 4px solid #94a3b8; border-radius: 14px; box-shadow: 0 4px 12px rgba(15,23,42,.04); }
.action-card small, .empty, .panel p { color: var(--muted); }
.tag, .status, .pill { display: inline-flex; align-items: center; border-radius: 999px; background: var(--blue-soft); color: var(--blue); padding: 4px 9px; font-size: 12px; font-weight: 800; border: 1px solid transparent; }
.status-running, .status.success, .status-success { background: #eaf8ef; color: #166534; border-color: #caedd8; }
.status-stopped, .status-neutral { background: #f2f5fa; color: #64748b; border-color: #dbe2ed; }
.status-warning { background: #fff4e2; color: #b45309; border-color: #fcdcb0; }
.status-error, .status-danger { background: #fdeeed; color: #b42318; border-color: #f7d2cf; }
.priority-high { border-left-color: var(--red); }
.priority-medium { border-left-color: var(--orange); }
.priority-low { border-left-color: var(--green); }
.dashboard-grid, .section-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-12 { grid-column: span 12; }
.funnel { display: grid; gap: 8px; padding-top: 10px; }
.funnel div { width: var(--w); min-height: 30px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: var(--c); color: #fff; border-radius: 5px; font-size: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding-top: 8px; }
.summary-grid div { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: linear-gradient(180deg, #fff, #fbfdff); }
.summary-grid strong { display: block; font-size: 24px; margin-top: 5px; color: #13233d; }
.trend-lines { position: relative; height: 168px; margin-top: 12px; border-radius: 12px; background: linear-gradient(#fff,#fff), repeating-linear-gradient(to bottom, transparent 0 32px, #eef2f7 33px); overflow: hidden; }
.trend-lines span, .trend-lines b { position: absolute; left: 8%; right: 6%; height: 74px; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--blue); top: 52px; transform: rotate(-7deg); }
.trend-lines b { border-top-color: var(--green); top: 76px; transform: rotate(10deg); }
.trend-labels { display: flex; justify-content: space-between; color: var(--muted); margin-top: 6px; }
.list-table { display: grid; gap: 0; margin-top: 8px; }
.list-table a, .order-row, .task, .list-row { display: grid; grid-template-columns: 1.5fr 1fr auto; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding: 12px 0; min-height: 48px; }
.list-table a:first-child, .order-row:first-of-type, .task:first-of-type, .list-row:first-of-type { border-top: 0; }
.list-table span, .list-table small, .order-row small { color: var(--muted); }
.kanban { display: grid; grid-template-columns: repeat(7, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 3px; }
.kanban-col { padding: 12px; background: #f8fafc; box-shadow: none; }
.kanban-card { display: grid; gap: 4px; margin-top: 10px; padding: 11px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.kanban-card small { color: var(--muted); }
.table-responsive { border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: auto; box-shadow: 0 4px 12px rgba(15,23,42,.04); }
.table { --bs-table-bg: transparent; font-size: 13px; margin: 0; }
.table thead th { position: sticky; top: 0; z-index: 1; background: #f8fafd; border-bottom: 1px solid var(--line); color: #64748b; font-weight: 700; font-size: 12px; letter-spacing: .01em; }
.table tbody td { height: 42px; vertical-align: middle; border-bottom-color: #eef2f8; }
.table tbody tr:hover { background: #f7faff; }
.form-control, .form-select { border-radius: 10px; border-color: #d3ddee; font-size: 13px; min-height: 38px; }
.form-control:focus, .form-select:focus { border-color: #93b3f4; box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15); }
.empty-state { color: var(--muted); background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 24px; text-align: center; }
.label { min-width: 116px; display: inline-block; color: var(--muted); }
.dot { width: 8px; height: 8px; display: inline-block; border-radius: 999px; margin: 0 5px 0 10px; }
.dot.green { background: var(--green); }
.dot.yellow { background: var(--orange); }
.dot.gray { background: #98a2b3; }
.mail-layout, .whatsapp-layout, .detail-layout, .settings-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr) 320px; gap: 12px; }
.mail-sidebar, .mail-list, .mail-reader, .chat-list, .chat-window, .profile-card, .settings-menu, .settings-panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.mail-item, .chat-item { display: grid; gap: 4px; border-radius: 10px; padding: 10px; border: 1px solid transparent; }
.mail-item:hover, .chat-item:hover { border-color: #bfdbfe; background: #f8fbff; }
.message-bubble { max-width: 72%; padding: 10px 12px; border-radius: 12px; background: #f1f5f9; margin: 8px 0; }
.message-bubble.out { margin-left: auto; background: #dff8d8; }
.progress-track { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 16px; position: relative; }
.progress-track div { display: grid; justify-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.progress-track span { width: 18px; height: 18px; border-radius: 999px; background: #d1d5db; border: 4px solid #f3f4f6; box-shadow: 0 0 0 1px var(--line); }
.progress-track div:first-child span, .progress-track div:nth-child(2) span { background: var(--green); }
.log-view, .log-feed { font-family: Consolas, Menlo, monospace; font-size: 12px; }
.log-feed { max-height: 420px; overflow: auto; }
.log-feed div { display: grid; grid-template-columns: 180px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.metric {
  border: 1px solid #e0e9f8;
  border-radius: 16px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.biz-timeline {
  display: grid;
  gap: 10px;
}

.biz-item {
  display: grid;
  gap: 6px;
  border: 1px solid #e2eaf8;
  border-left: 4px solid #2563eb;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
}

.biz-item time {
  color: #7a8faa;
  font-size: 11px;
  font-family: Consolas, Menlo, monospace;
}

.biz-item .type {
  width: fit-content;
}

.biz-item strong {
  color: #1f3659;
  font-size: 13px;
}

.biz-item small {
  color: #6e84a4;
  font-size: 12px;
}
pre { white-space: pre-wrap; word-break: break-word; margin: 0; max-height: 640px; overflow: auto; }
.login-body { min-height: 100vh; background: linear-gradient(135deg, #08111f 0%, #0f1c34 46%, #f5f7fb 46%, #f5f7fb 100%); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 48%) minmax(360px, 52%); }
.login-brand-panel { display: grid; align-content: space-between; min-height: 100vh; padding: 54px; color: #eaf2ff; background: radial-gradient(circle at top left, rgba(31,111,255,.28), transparent 34%), linear-gradient(180deg, #0d1728, #071120); }
.login-brand { padding: 0; }
.login-brand-panel h1 { margin: 14px 0 10px; color: #fff; font-size: clamp(36px, 5vw, 58px); font-weight: 850; letter-spacing: 0; }
.login-brand-panel p { max-width: 520px; color: #cbd7ea; font-size: 17px; }
.login-feature-list { display: grid; gap: 12px; margin: 28px 0; padding: 0; list-style: none; }
.login-feature-list li { display: flex; align-items: center; gap: 10px; color: #dbe7ff; font-weight: 700; }
.login-feature-list li::before { content: ""; width: 9px; height: 9px; border-radius: 999px; background: #1f6fff; box-shadow: 0 0 0 4px rgba(31,111,255,.18); }
.login-form-panel { display: grid; place-items: center; min-height: 100vh; padding: 48px; }
.login-card { width: min(100%, 430px); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.12); }
.login-card h2 { margin: 0; font-size: 28px; font-weight: 850; letter-spacing: 0; }
.login-card p { color: var(--muted); }
.remember-row { display: flex; align-items: center; gap: 9px; color: #334155; font-weight: 700; }
.auth-alert { padding: 11px 12px; border: 1px solid #fecaca; border-radius: 10px; background: #fef2f2; color: #b91c1c; font-weight: 750; }
.login-footer { margin: 18px 0 0; font-size: 12px; text-align: center; }

.notification-menu { position: relative; }
.notification-menu summary { list-style: none; }
.notification-menu summary::-webkit-details-marker { display: none; }
.notification-summary { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.notification-preview-type.type-email {
  background: #ffe6e8;
  color: #b42318;
}

.notification-preview-type.type-order {
  background: #fff0df;
  color: #c2410c;
}

.notification-preview-type.type-lead {
  background: #e7f0ff;
  color: #1d4ed8;
}

.notification-preview-type.type-system {
  background: #fff7db;
  color: #b45309;
}
.notification-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(360px, calc(100vw - 24px));
  max-height: 420px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  z-index: 40;
}
.notification-dropdown-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.notification-dropdown-head a { color: var(--blue); font-weight: 750; font-size: 12px; }
.notification-preview { display: grid; gap: 4px; padding: 10px; border-radius: 10px; border: 1px solid transparent; }
.notification-preview:hover { background: #f8fbff; border-color: #bfdbfe; }
.notification-preview strong { font-size: 13px; }
.notification-preview small { color: var(--muted); }
.notification-empty { margin: 0; padding: 8px 10px; color: var(--muted); }

.notification-home-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.notification-home-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.notification-home-card strong { font-size: 14px; }

.pill,
.tag,
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border-radius: 999px;
  border: 1px solid #d7e1f4;
  background: #eff4ff;
  color: #2563eb;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.status-success { background: #eaf8ef; color: #166534; border-color: #caedd8; }
.status-warning { background: #fff4e2; color: #b45309; border-color: #fcdcb0; }
.status-danger { background: #fdeeed; color: #b42318; border-color: #f7d2cf; }
.status-neutral { background: #f2f5fa; color: #64748b; border-color: #dbe2ed; }

.order-toolbar-shell,
.followup-toolbar-shell {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.order-toolbar-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 4px;
}

.order-toolbar-head h2,
.followup-toolbar-shell h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: #172b4d;
}

.order-toolbar-head small,
.followup-toolbar-shell small {
  color: var(--muted);
  font-weight: 600;
}

.order-create-toggle {
  list-style: none;
  cursor: pointer;
}

.order-create-toggle::-webkit-details-marker {
  display: none;
}

.order-create-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #d8e2f2;
}

.order-kpi-grid,
.followup-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.order-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.order-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d8e2f3;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  transition: all .15s ease;
}

.order-tab:hover {
  border-color: #b8cef4;
  color: #1d4ed8;
  background: #f8fbff;
}

.order-tab.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .26);
}

.order-table td {
  white-space: nowrap;
}

.order-row-enterprise {
  transition: background-color .14s ease;
}

.order-nav-link {
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}

.order-nav-link:hover,
.order-nav-link:focus {
  color: var(--blue);
  text-decoration: underline;
}

.status-inline-form {
  min-width: 128px;
}

.status-inline-form .form-select {
  min-height: 30px;
  font-size: 12px;
}

.followup-timeline {
  position: relative;
  display: grid;
  gap: 10px;
  padding-left: 24px;
}

.followup-timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 2px;
  bottom: 2px;
  width: 2px;
  background: linear-gradient(180deg, #cbdaf3, #e2e8f0);
}

.followup-item {
  position: relative;
  display: block;
  border: 1px solid #e3eaf5;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  transition: all .16s ease;
}

.followup-item:hover {
  border-color: #c9d9f3;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .1);
  transform: translateY(-1px);
}

.followup-dot {
  position: absolute;
  left: -24px;
  top: 11px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px #fff;
}

.followup-dot.danger { background: #dc2626; }
.followup-dot.warning { background: #f59e0b; }
.followup-dot.success { background: #16a34a; }

.followup-main {
  display: grid;
  gap: 6px;
}

.followup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.followup-head strong {
  font-size: 13px;
  color: #1f2b3d;
}

.followup-time {
  color: #64748b;
  font-size: 12px;
}

.followup-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.followup-main p {
  margin: 0;
  font-size: 12px;
  color: #5f7088;
  line-height: 1.35;
}

.ops-shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ops-module {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.ops-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.ops-head h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #172b4d;
}

.ops-eyebrow {
  margin: 0 0 6px;
  color: #5b7fb6;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.ops-status {
  border-radius: 999px;
  border: 1px solid #d9e5f7;
  background: #f4f8ff;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}

.ops-status.running {
  border-color: #bfe8d0;
  background: #ecfbf2;
  color: #0f7a3f;
}

.ops-status.stopped {
  border-color: #d6dee9;
  background: #f3f6fb;
  color: #516178;
}

.ops-status.error {
  border-color: #ffd3d0;
  background: #fff1f0;
  color: #b42318;
}

.ops-status.warning {
  border-color: #fcdcb0;
  background: #fff4e2;
  color: #b45309;
}

.ops-status.starting {
  border-color: #f9d18d;
  background: #fff7e8;
  color: #b45309;
}

.ops-status.stopping {
  border-color: #fdc9a3;
  background: #fff2e8;
  color: #c2410c;
}

.ops-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-actions form {
  margin: 0;
}

.ops-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ops-metrics article {
  border: 1px solid #e4ecf8;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.ops-metrics span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.ops-metrics strong {
  display: block;
  margin-top: 6px;
  color: #102445;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.ops-mini-log {
  border: 1px solid #e3eaf7;
  border-radius: 12px;
  background: #f9fbff;
}

.ops-mini-log h3 {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  color: #223654;
  border-bottom: 1px solid #e3eaf7;
}

.ops-mini-log > div {
  max-height: 178px;
  overflow: auto;
  padding: 6px 10px;
}

.ops-mini-log p {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid #edf2fb;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  font-size: 12px;
  color: #425a7b;
}

.ops-mini-log p:last-child {
  border-bottom: 0;
}

.ops-mini-log time {
  color: #7b8da8;
  font-family: Consolas, Menlo, monospace;
}

.ops-kpis {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.ops-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.ops-kpi-grid article {
  border: 1px solid #e2ebf8;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.ops-kpi-grid span {
  color: #7187a8;
  font-size: 12px;
  font-weight: 700;
}

.ops-kpi-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
  color: #0f2a52;
}

.ops-live .card-title small {
  color: #5874a2;
}

.ops-log-feed {
  max-height: 320px;
}

.ops-log-feed div {
  grid-template-columns: 170px 1fr;
}

.ops-settings-form {
  margin: 0;
}

.ops-inline-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.ops-inline-fields label {
  display: grid;
  gap: 6px;
  color: #526782;
  font-size: 12px;
  font-weight: 700;
}

.v4-hero {
  background: radial-gradient(circle at right top, rgba(37, 99, 235, .14), transparent 34%), linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.v4-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.v4-hero h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 820;
  color: #11284c;
}

.v4-subline {
  margin: 8px 0 0;
  color: #617a9e;
  font-size: 14px;
}

.v4-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.v4-kpi-card {
  position: relative;
  display: block;
  border: 1px solid #e0e9f8;
  border-radius: 16px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
  transition: all .14s ease;
}

.v4-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(37, 99, 235, .12);
  border-color: #bfd3f8;
}

.v4-kpi-card span {
  color: #6b7f9d;
  font-size: 12px;
  font-weight: 700;
}

.v4-kpi-card strong {
  display: block;
  margin-top: 10px;
  color: #0f2853;
  font-size: 32px;
  line-height: 1;
  font-weight: 860;
}

.v4-kpi-card small {
  display: block;
  margin-top: 8px;
  color: #5f7699;
}

.v4-kpi-card i {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #2563eb;
  background: #eef4ff;
  font-style: normal;
  font-weight: 800;
}

.v4-section {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.v4-status-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.v4-status-card {
  border: 1px solid #e0eaf8;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  transition: all .14s ease;
}

.v4-status-card:hover {
  border-color: #bcd2f5;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .1);
}

.v4-status-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.v4-status-head strong {
  font-size: 15px;
  color: #12325f;
}

.v4-badge {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid #d7e3f6;
  color: #4f688c;
  background: #f2f6fd;
}

.v4-badge.ok {
  border-color: #bde8cd;
  color: #116a38;
  background: #e9fbf0;
}

.v4-badge.err {
  border-color: #ffd3d0;
  color: #b42318;
  background: #fff1f0;
}

.v4-badge.warn {
  border-color: #f9d18d;
  color: #b45309;
  background: #fff7e8;
}

.v4-badge.off {
  border-color: #d9e4f4;
  color: #637992;
  background: #f4f8ff;
}

.v4-status-card p {
  margin: 5px 0;
  color: #5f7595;
  font-size: 12px;
}

.v4-work-grid {
  align-items: stretch;
}

.v4-work-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.v4-work-group {
  border: 1px solid #e2eaf8;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.v4-work-group h3 {
  margin: 0 0 10px;
  color: #19345f;
  font-size: 13px;
  font-weight: 800;
}

.v4-work-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #edf2fb;
}

.v4-work-item:first-of-type {
  border-top: 0;
}

.v4-work-item a {
  color: #1d4ed8;
  font-weight: 750;
}

.v4-work-item a:hover {
  text-decoration: underline;
}

.v4-work-item span {
  color: #7086a5;
  font-size: 12px;
}

.v4-timeline {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.v4-time-item {
  display: grid;
  gap: 4px;
  border: 1px solid #e1eaf7;
  border-left: 4px solid #2563eb;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
}

.v4-time-item time {
  color: #7a8faa;
  font-size: 11px;
  font-family: Consolas, Menlo, monospace;
}

.v4-time-badge {
  width: fit-content;
  border-radius: 999px;
  border: 1px solid #d6e4fa;
  background: #edf4ff;
  color: #2255ad;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
}

.v4-time-item strong {
  color: #213a60;
  font-size: 13px;
}

.v4-time-item small {
  color: #788ca8;
  font-size: 12px;
}

.v4-actions-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.v4-action-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid #d8e4f7;
  background: #fff;
  color: #18427f;
  font-size: 13px;
  font-weight: 800;
  transition: all .13s ease;
}

.v4-action-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.home-notify-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.home-notify-card {
  border: 1px solid #e0eaf8;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.home-notify-card span {
  font-size: 12px;
  font-weight: 800;
}

.home-notify-card strong {
  font-size: 28px;
  line-height: 1;
  color: #142f57;
}

.home-notify-card small {
  color: #667e9f;
}

.home-notify-card.notify-email {
  border-color: #ffd3d0;
  background: #fff5f5;
}

.home-notify-card.notify-email span {
  color: #b42318;
}

.home-notify-card.notify-order {
  border-color: #fdc9a3;
  background: #fff6ed;
}

.home-notify-card.notify-order span {
  color: #c2410c;
}

.home-notify-card.notify-lead {
  border-color: #bfd3f8;
  background: #f3f8ff;
}

.home-notify-card.notify-lead span {
  color: #1d4ed8;
}

.home-notify-card.notify-system {
  border-color: #f8dea1;
  background: #fffaeb;
}

.home-notify-card.notify-system span {
  color: #b45309;
}

.mail-ai-inline {
  margin: -4px 0 8px;
  padding-left: 130px;
  display: grid;
  gap: 2px;
}

.mail-ai-inline span {
  color: #274260;
  font-size: 12px;
}

.email-command-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.email-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mail-v3-layout {
  display: grid;
  grid-template-columns: minmax(220px, 18%) minmax(460px, 52%) minmax(320px, 30%);
  gap: 12px;
  align-items: start;
}

.mail-v3-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  min-height: 660px;
  overflow: hidden;
}

.mail-v3-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid #e5ecf7;
  background: #fbfdff;
}

.mail-v3-head h2,
.mail-v3-head h3,
.mail-v3-block h4,
.mail-detail-v3 h1,
.mail-detail-v3 h2 {
  margin: 0;
  color: #122745;
}

.mail-v3-head h2,
.mail-v3-head h3 { font-size: 16px; font-weight: 820; }
.mail-v3-head small { color: #68809f; font-weight: 700; }

.mail-v3-folder-list {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.mail-v3-folder {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-radius: 11px;
  padding: 10px 11px;
  color: #304760;
  font-weight: 760;
  border: 1px solid transparent;
}

.mail-v3-folder:hover {
  background: #f4f8ff;
  border-color: #d9e5f7;
}

.mail-v3-folder.active {
  color: #1e50b5;
  background: #ecf3ff;
  border-color: #bfd4f8;
}

.mail-v3-tags,
.mail-v3-mailbox {
  margin: 8px 10px 10px;
  border: 1px solid #e3ebf8;
  border-radius: 12px;
  background: #f9fbff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.mail-v3-tags h3,
.mail-v3-mailbox h3 {
  margin: 0;
  font-size: 13px;
  color: #1d3658;
  font-weight: 800;
}

.mail-v3-mailbox p,
.mail-v3-mailbox small {
  margin: 0;
  color: #5d7699;
}

.mail-v3-list-scroll {
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding: 8px;
}
.mail-select-all-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #2a456a;
  font-weight: 760;
}
.mail-select-all-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
}
.mail-bulk-toolbar {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2eaf8;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}
.mail-bulk-toolbar strong {
  color: #16345f;
  font-size: 13px;
}
.mail-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mail-v3-item {
  display: grid;
  gap: 10px;
  border: 1px solid #e2eaf8;
  border-radius: 12px;
  background: #fff;
  margin-bottom: 8px;
  padding: 12px;
  transition: all .14s ease;
  cursor: pointer;
}
.mail-v3-item-select {
  display: flex;
  align-items: center;
}
.mail-v3-item-select input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.mail-v3-item:hover,
.mail-v3-item.active {
  border-color: #b8cef4;
  background: #f6f9ff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .1);
}

.mail-v3-title-row,
.mail-v3-meta,
.mail-v3-reader-line,
.mail-v3-ai-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mail-v3-sender {
  color: #19345f;
  font-weight: 800;
}

.mail-v3-time {
  color: #6f87a7;
  font-size: 12px;
}

.mail-v3-title-row strong {
  color: #132b4b;
  font-size: 15px;
}

.mail-customer-name-row {
  display: flex;
  align-items: center;
  min-height: 36px;
}

.mail-customer-badge {
  font-weight: 700;
  font-size: 18px;
  padding: 6px 12px;
  border-radius: 999px;
  display: inline-block;
  line-height: 1.25;
}

.mail-customer-badge--linked,
.mail-customer-name-highlight {
  background: #d32f2f;
  color: #ffffff;
}

.mail-customer-badge--unlinked,
.mail-customer-name-unlinked {
  background: #fff9db;
  color: #3a2a00;
  border: 1px solid #f4d277;
}

.mail-customer-badge--lead {
  background: #1976d2;
  color: #ffffff;
}

.mail-customer-badge--order {
  background: #2e7d32;
  color: #ffffff;
}

.crm-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.crm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
}

.crm-modal-dialog {
  position: relative;
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 12px auto;
  border: 1px solid #d8e2f4;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, .24);
  overflow: auto;
}

.crm-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #e4ebf8;
}

.crm-modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #152a4a;
}

.crm-modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 16px;
}

.crm-modal-body label {
  display: grid;
  gap: 5px;
  color: #2f4463;
  font-size: 12px;
  font-weight: 700;
}

.crm-modal-conflict {
  grid-column: 1 / -1;
  border: 1px solid #f6cfcb;
  background: #fff3f2;
  border-radius: 10px;
  padding: 10px;
}

.crm-modal-conflict p {
  margin: 0 0 8px;
  color: #a6362a;
  font-size: 13px;
  font-weight: 700;
}

.crm-modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.mail-customer-list-banner-link {
  position: relative;
  display: grid;
  gap: 4px;
  width: 100%;
  border-radius: 12px;
  padding: 12px 14px 12px 16px;
  text-decoration: none;
  overflow: hidden;
  border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  display: none;
}

.mail-customer-list-banner-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.mail-customer-list-banner-main {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.02em;
  padding-left: 6px;
}

.mail-customer-list-banner-sub {
  font-size: 12px;
  font-weight: 760;
  opacity: 0.95;
  padding-left: 6px;
}

.mail-customer-list-banner-link.grade-a {
  background: #861d2d;
  color: #ffffff;
}

.mail-customer-list-banner-link.grade-a::before {
  background: #5f1220;
}

.mail-customer-list-banner-link.grade-b {
  background: #b66814;
  color: #ffffff;
}

.mail-customer-list-banner-link.grade-b::before {
  background: #8f4f0e;
}

.mail-customer-list-banner-link.grade-c {
  background: #1f548e;
  color: #ffffff;
}

.mail-customer-list-banner-link.grade-c::before {
  background: #173f6b;
}

.mail-customer-list-banner-link.grade-d {
  background: #5b6678;
  color: #ffffff;
}

.mail-customer-list-banner-link.grade-d::before {
  background: #454f5f;
}

.mail-customer-list-banner-link.grade-vip {
  background: #f0c74a;
  color: #2f2500;
}

.mail-customer-list-banner-link.grade-vip::before {
  background: #d8a900;
}

.mail-customer-list-banner-link.unlinked {
  background: #fff8d6;
  color: #624803;
  border-color: #f0d98f;
}

.mail-customer-list-banner-link.unlinked::before {
  background: #e0b314;
}

.mail-customer-list-banner-link:hover {
  box-shadow: 0 12px 24px rgba(16, 34, 61, 0.22);
  transform: translateY(-1px);
  filter: brightness(0.98);
}

.mail-customer-list-banner-link:hover::after {
  content: "打开客户详情 ->";
  position: absolute;
  right: 10px;
  top: 8px;
  font-size: 11px;
  font-weight: 760;
  opacity: 0.92;
}

.mail-customer-list-banner-link.unlinked:hover::after {
  content: "";
}

.mail-customer-list-create {
  justify-self: end;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 800;
  color: #5c4302;
  background: #ffe694;
  border: 1px solid #e2c76f;
  border-radius: 999px;
  min-height: 26px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.mail-customer-list-create:hover {
  background: #f9dd81;
}

.mail-v3-dot {
  border-radius: 999px;
  border: 1px solid #fad6d2;
  background: #fff3f1;
  color: #b42318;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
}

.mail-v3-ai {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mail-v3-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill.tag-inquiry { background: #e8f1ff; color: #1d4ed8; border-color: #bfd7ff; }
.pill.tag-oem,
.pill.tag-odm { background: #f3ebff; color: #6d28d9; border-color: #d8c4ff; }
.pill.tag-sample,
.pill.tag-logistics { background: #e6fbff; color: #0e7490; border-color: #b8ebf4; }
.pill.tag-order { background: #eaf8ef; color: #166534; border-color: #caedd8; }
.pill.tag-payment { background: #fff4e2; color: #b45309; border-color: #fcdcb0; }
.pill.tag-tech { background: #edf3ff; color: #3b5b8a; border-color: #cfdbef; }
.pill.tag-after-sale { background: #f2f5fa; color: #4b5563; border-color: #d7dfe9; }
.pill.tag-complaint,
.pill.tag-important { background: #fdeeed; color: #b42318; border-color: #f7d2cf; }
.pill.tag-vip { background: #fff8db; color: #9a6700; border-color: #f0dca0; }
.pill.tag-ignore { background: #f3f4f6; color: #6b7280; border-color: #d5dae2; }
.pill.tag-default { background: #eff4ff; color: #2563eb; border-color: #d7e1f4; }

.mail-v3-summary {
  margin: 0;
  color: #5b7396;
  font-size: 12px;
  line-height: 1.45;
}

.mail-v3-meta {
  color: #7a90ab;
  font-size: 11px;
  justify-content: flex-end;
}

.mail-v3-card-unlinked {
  color: #8a5a08;
  font-size: 11px;
  font-weight: 700;
}

.mail-v3-reader-body {
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding: 14px;
}

.mail-v3-reader-title {
  margin: 0;
  color: #102646;
  font-size: 20px;
  font-weight: 830;
}

.mail-v3-reader-line {
  margin-top: 8px;
  color: #607899;
  font-size: 12px;
}

.mail-v3-block {
  margin-top: 12px;
  border: 1px solid #e4ebf8;
  border-radius: 12px;
  background: #f9fbff;
  padding: 12px;
}

.mail-v3-block h4 {
  font-size: 13px;
  font-weight: 820;
  margin-bottom: 8px;
}

.mail-v3-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  color: #4d6688;
  font-size: 12px;
}

.mail-v3-ai-line span,
.mail-v3-ai-action,
.mail-v3-ai-summary {
  margin: 0;
  color: #526a8c;
  font-size: 12px;
}

.mail-v3-ai-summary-block {
  display: grid;
  gap: 4px;
  margin: 8px 0;
}

.mail-v3-body {
  max-height: 340px;
  overflow: auto;
  border: 1px solid #dfe8f6;
  border-radius: 10px;
  background: #fff;
  padding: 12px;
  color: #1c2e48;
  line-height: 1.55;
}

.mail-email-reader {
  background: #fff;
  border-radius: 12px;
}

.mail-email-content {
  max-width: 980px;
  color: #1b2f4d;
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.mail-email-content a {
  color: #1d4ed8;
  text-decoration: underline;
}

.mail-email-content img {
  max-width: 100%;
  height: auto;
}

.mail-email-content table {
  width: 100%;
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

.mail-email-content th,
.mail-email-content td {
  border: 1px solid #dbe5f4;
  padding: 8px;
}

.mail-email-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 980px;
  line-height: 1.6;
  color: #1b2f4d;
  font-size: 15px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

.mail-email-secondary {
  color: #61748f;
  font-size: 13px;
}

.mail-quote-toggle {
  margin-top: 14px;
  border-top: 1px dashed #d8e3f5;
  padding-top: 10px;
}

.mail-quote-toggle summary {
  cursor: pointer;
  color: #315a95;
  font-size: 13px;
  font-weight: 750;
  list-style: none;
}

.mail-quote-toggle summary::-webkit-details-marker {
  display: none;
}

.mail-fold-toggle,
.mail-thread-toggle,
.mail-fold-mini {
  background: #f8fbff;
  border: 1px solid #e0e9f6;
  border-radius: 10px;
  padding: 10px 12px;
}

.mail-fold-mini {
  margin-top: 10px;
}

.mail-thread-timeline {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.mail-thread-item {
  border: 1px solid #e2e9f6;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.mail-thread-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.mail-thread-head strong {
  color: #15345f;
  font-size: 14px;
}

.mail-thread-head span {
  color: #6d83a4;
  font-size: 12px;
}

.mail-thread-subject {
  margin: 0 0 10px;
  color: #3f587c;
  font-size: 12px;
  font-weight: 700;
}

.mail-thread-body {
  max-width: 920px;
}

.mail-v3-attachments,
.mail-detail-v3-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mail-v3-attachment {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d8e5f9;
  background: #eef5ff;
  color: #1b4fae;
  font-size: 12px;
  font-weight: 760;
}

.mail-v3-attachment.disabled {
  color: #68809f;
  background: #f4f7fb;
  border-color: #dbe4f3;
}

.mail-v3-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mail-v3-actions form {
  margin: 0;
}

.mail-v3-customer-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mail-v3-customer-actions form {
  margin: 0;
}

.mail-v3-link-customer-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mail-v3-tag-editor {
  display: grid;
  gap: 10px;
}

.mail-v3-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mail-v3-tag-item {
  margin: 0;
}

.mail-v3-tag-item .pill {
  border: 0;
  cursor: pointer;
}

.mail-v3-tag-form details {
  display: grid;
  gap: 10px;
}

.mail-v3-tag-form summary {
  list-style: none;
  cursor: pointer;
  width: fit-content;
}

.mail-v3-tag-form summary::-webkit-details-marker {
  display: none;
}

.mail-v3-tag-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.mail-v3-tag-preset-grid label {
  font-size: 12px;
  color: #4d678a;
}

.mail-customer-banner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 12px 16px;
  text-decoration: none;
  margin: 0;
}

.mail-customer-banner.grade-a {
  background: #861d2d;
  color: #ffffff;
}

.mail-customer-banner.grade-b {
  background: #b66814;
  color: #ffffff;
}

.mail-customer-banner.grade-c {
  background: #1f548e;
  color: #ffffff;
}

.mail-customer-banner.grade-d {
  background: #5b6678;
  color: #ffffff;
}

.mail-customer-banner.grade-vip {
  background: #f0c74a;
  color: #2f2500;
}

a.mail-customer-banner:hover {
  filter: brightness(1.04);
}

.mail-customer-banner-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mail-customer-banner-main span {
  font-size: 24px;
  font-weight: 860;
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-customer-banner-main strong {
  font-size: 14px;
  font-weight: 820;
  opacity: 0.95;
  white-space: nowrap;
}

.mail-customer-banner-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 14px;
  font-size: 12px;
  font-weight: 760;
}

.mail-customer-list-row {
  margin-top: 8px;
}

.mail-customer-list-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  max-width: 100%;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid transparent;
}

.mail-customer-list-badge em {
  font-style: normal;
  font-size: 11px;
  font-weight: 820;
  opacity: 0.95;
}

.mail-customer-list-badge strong {
  font-size: 13px;
  font-weight: 830;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-customer-list-badge.grade-a {
  background: #861d2d;
  color: #ffffff;
}

.mail-customer-list-badge.grade-b {
  background: #b66814;
  color: #ffffff;
}

.mail-customer-list-badge.grade-c {
  background: #1f548e;
  color: #ffffff;
}

.mail-customer-list-badge.grade-d {
  background: #5b6678;
  color: #ffffff;
}

.mail-customer-list-badge.grade-vip {
  background: #f0c74a;
  color: #2f2500;
}

.mail-detail-v3 {
  display: grid;
  gap: 12px;
}

.mail-detail-v3-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 0;
}

.mail-detail-v3 h1 {
  font-size: 28px;
  font-weight: 850;
}

.mail-detail-v3-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: #5f7698;
  font-size: 12px;
}

.mail-detail-v3-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  gap: 12px;
}

.mail-detail-v3-main,
.mail-detail-v3-side {
  margin-bottom: 0;
  display: grid;
  gap: 12px;
}

.mail-detail-v3-block {
  border: 1px solid #e4ebf8;
  border-radius: 14px;
  background: #fbfdff;
  padding: 14px;
}

.mail-detail-v3-block h2,
.mail-detail-v3-side h2 {
  font-size: 16px;
  font-weight: 820;
  margin-bottom: 10px;
}

.mail-detail-v3-ai-kv,
.mail-detail-v3-kv-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
}

.mail-detail-v3-ai-kv span,
.mail-detail-v3-kv-grid span {
  color: #5f7596;
  font-size: 12px;
}

.mail-detail-v3-ai-kv strong,
.mail-detail-v3-kv-grid strong {
  color: #1d3659;
  font-size: 13px;
}

.mail-detail-v3-body {
  border: 1px solid #dce6f6;
  border-radius: 12px;
  background: #fff;
  padding: 28px 32px;
  min-height: 520px;
  max-height: none;
  overflow: visible;
  line-height: 1.6;
  font-size: 16px;
  color: #1f324f;
}

.mail-detail-v3-title-wrap {
  display: grid;
  gap: 6px;
}

.mail-detail-v3-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mail-detail-inline-btn {
  margin-top: 10px;
}

.mail-detail-inline-toolbar {
  margin-top: 12px;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
}

.mail-detail-inline-toolbar .btn {
  white-space: nowrap;
  flex: 0 0 auto;
}

.mail-detail-link-panel {
  margin-top: 8px;
}

.mail-detail-link-panel .mail-v3-link-customer-form {
  flex-wrap: wrap;
}

.mail-detail-unlinked {
  margin: 0;
  color: #8a5a08;
  font-size: 13px;
  font-weight: 750;
}

.mail-detail-v3-actions {
  display: grid;
  gap: 8px;
}

.mail-action-group-title {
  margin: 8px 0 0;
  color: #5f7596;
  font-size: 12px;
  font-weight: 800;
}

.mail-detail-delete-form {
  margin: 0;
}

.mail-detail-v3-actions .btn {
  width: 100%;
  justify-content: center;
}

.mail-ai-inline small {
  color: #8aa0bd;
  font-size: 11px;
}

@media (max-width: 1480px) {
  .mail-v3-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .mail-v3-reader { grid-column: span 2; }
}

@media (max-width: 1320px) {
  .priority-board { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .action-grid.compact { grid-template-columns: repeat(2, 1fr); }
  .ops-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .v4-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v4-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v4-actions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 1fr; }
  .mail-bulk-actions { gap: 6px; }
  .mail-bulk-actions .btn { min-height: 32px; padding: 0 10px; }
  .sidebar { position: static; height: auto; }
  .operator-card { position: static; margin-top: 18px; }
  .content { padding: 0 16px 18px; }
  .topbar { grid-template-columns: 1fr; padding: 10px 0; }
  .runtime-strip { top: 60px; }
  .page-head { display: grid; align-items: start; }
  .priority-board, .kpi-grid, .action-grid.compact { grid-template-columns: 1fr; }
  .span-4, .span-5, .span-6, .span-7 { grid-column: span 12; }
  .mail-layout, .whatsapp-layout, .detail-layout, .settings-layout { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand-panel, .login-form-panel { min-height: auto; padding: 32px 20px; }
  .login-body { background: #f5f7fb; }
  .notification-home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-toolbar-head { display: grid; }
  .order-kpi-grid,
  .followup-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .order-table td { white-space: normal; }
  .ops-shell { grid-template-columns: 1fr; }
  .ops-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-inline-fields { grid-template-columns: 1fr; }
  .v4-hero-head { display: grid; }
  .v4-kpi-grid,
  .v4-status-grid,
  .v4-actions-grid,
  .home-notify-grid { grid-template-columns: 1fr; }
  .v4-work-item { display: grid; align-items: start; }
  .email-command-bar { flex-direction: column; align-items: stretch; }
  .email-command-bar .global-search { width: 100%; }
  .mail-v3-layout { grid-template-columns: 1fr; }
  .mail-v3-panel { min-height: auto; }
  .mail-v3-list-scroll,
  .mail-v3-reader-body,
  .mail-detail-v3-body { max-height: none; }
  .mail-customer-list-banner-main { font-size: 18px; }
  .mail-customer-list-banner-sub { font-size: 11px; }
  .mail-v3-kv { grid-template-columns: 1fr; }
  .mail-customer-banner {
    display: grid;
    justify-content: stretch;
  }
  .mail-customer-banner-main span {
    font-size: 20px;
  }
  .mail-customer-banner-metrics {
    justify-content: flex-start;
  }
  .mail-detail-v3-head { display: grid; }
  .mail-detail-v3-meta { display: grid; gap: 6px; }
  .mail-detail-v3-grid { grid-template-columns: 1fr; }
  .mail-detail-v3-body { padding: 18px; min-height: 320px; }
  .mail-detail-v3-ai-kv,
  .mail-detail-v3-kv-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .order-kpi-grid,
  .followup-kpi-grid { grid-template-columns: 1fr; }
  .ops-metrics,
  .ops-kpi-grid { grid-template-columns: 1fr; }
  .ops-mini-log p,
  .ops-log-feed div { grid-template-columns: 1fr; gap: 4px; }
  .biz-item { border-left-width: 3px; }
  .v4-hero h2 { font-size: 28px; }
  .page-head { align-items: start; flex-direction: column; }
  .quick-actions { justify-content: flex-start; }
  .mail-customer-list-banner-main { font-size: 17px; }
  .mail-customer-list-banner-link { padding: 11px 12px 11px 14px; }
}
