:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --text: #152033;
  --muted: #64748b;
  --line: #d8e1ec;
  --primary: #2563eb;
  --primary-dark: #173f91;
  --cyan: #0891b2;
  --green: #0f766e;
  --red: #b42318;
  --amber: #b7791f;
  --gold: #c9973f;
  --rose: #d94875;
  --ink: #0f172a;
  --sidebar: #101827;
  --sidebar-soft: #18253a;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.11);
  --shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(238, 243, 248, 0.92) 38%, #e7edf4),
    repeating-linear-gradient(90deg, rgba(37, 99, 235, 0.035) 0 1px, transparent 1px 96px),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  min-height: 100vh;
}

::selection {
  color: #fff;
  background: #2563eb;
}

.hidden {
  display: none !important;
}

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

button {
  border: 0;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2f74ff, #174ea6);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 9px 18px rgba(37, 99, 235, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

button:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.27);
}

.nav-item:hover {
  transform: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  filter: none;
}

button.ghost,
.import-label {
  color: #173f91;
  background: linear-gradient(180deg, #f7fbff, #eaf3ff);
  border: 1px solid #c5d8f7;
  box-shadow: 0 6px 14px rgba(30, 64, 175, 0.08);
}

button.ghost.danger {
  color: var(--red);
  background: linear-gradient(180deg, #fffafa, #fff1f1);
  border-color: rgba(180, 35, 24, 0.32);
}

button.ghost.danger:hover {
  box-shadow: 0 8px 16px rgba(180, 35, 24, 0.12);
}

button.ai-action {
  color: #6d3dc5;
  background: linear-gradient(180deg, #fbf8ff, #f1eaff);
  border-color: rgba(109, 61, 197, 0.28);
}

button.ai-action:hover {
  box-shadow: 0 8px 16px rgba(109, 61, 197, 0.14);
}

button.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #cfd9e7;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #4f8df7;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

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

td {
  color: #27364a;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, #edf4fb, #e4ebf4);
  color: #26364f;
  font-weight: 800;
}

tbody tr:nth-child(even) {
  background: #fbfdff;
}

tbody tr:hover {
  background: #f0f7ff;
}

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

h1,
h2,
h3,
p,
pre {
  margin: 0;
}

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

.app.locked {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(16, 24, 39, 0.96), rgba(23, 63, 145, 0.85) 48%, rgba(15, 118, 110, 0.74)),
    #101827;
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  width: min(440px, 100%);
  padding: 26px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.26);
  backdrop-filter: blur(16px);
}

.auth-head {
  margin-bottom: 18px;
}

.auth-head h1 {
  color: var(--ink);
  font-size: 25px;
  letter-spacing: 0;
}

.auth-head p,
.auth-message {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form button {
  width: 100%;
  min-height: 42px;
}

.wechat-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 12px;
  border: 1px solid rgba(7, 193, 96, 0.45);
  border-radius: 8px;
  color: #067a3a;
  font-weight: 800;
  text-decoration: none;
  background: linear-gradient(180deg, rgba(240, 253, 244, 0.96), rgba(220, 252, 231, 0.92));
  box-shadow: 0 12px 26px rgba(7, 193, 96, 0.12);
}

.wechat-login:hover {
  border-color: rgba(7, 193, 96, 0.7);
  transform: translateY(-1px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 120px),
    linear-gradient(165deg, #0d1524 0%, #13223a 48%, #102b35 100%);
  color: #fff;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.07), 10px 0 30px rgba(15, 23, 42, 0.10);
}

.brand {
  padding: 6px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
}

.brand::before {
  content: "";
  display: block;
  width: 34px;
  height: 4px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), #58d6c7, #79a8ff);
}

.brand h1 {
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.brand div {
  margin-top: 6px;
  color: #b8c7db;
  font-size: 13px;
}

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

.nav-item {
  justify-content: flex-start;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  color: #dbe7ff;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.35), rgba(8, 145, 178, 0.18));
  border-color: rgba(148, 197, 255, 0.28);
  box-shadow: inset 3px 0 0 var(--gold), 0 10px 22px rgba(2, 6, 23, 0.20);
}

.nav-item:not(.active):hover {
  background: rgba(255, 255, 255, 0.07);
  transform: none;
  box-shadow: none;
}

.side-actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.user-card {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.055));
}

.user-card strong {
  color: #fff;
  font-size: 14px;
}

.user-card span {
  color: #cbd5e1;
  font-size: 12px;
}

.full-btn {
  width: 100%;
}

.import-label {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.import-label input {
  display: none;
}

.main {
  min-width: 0;
  padding: 24px;
}

.main-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 19px 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94)),
    #fff;
  border: 1px solid rgba(199, 214, 232, 0.88);
  border-radius: 8px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.main-header::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--gold), var(--cyan), var(--primary));
}

.main-header::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 0;
  left: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.38), rgba(15, 118, 110, 0.30), transparent);
}

.main-header > * {
  position: relative;
  z-index: 1;
}

.main-header h2 {
  color: var(--ink);
  font-size: 25px;
  letter-spacing: 0;
}

.main-header p {
  margin-top: 6px;
  color: var(--muted);
}

.header-actions,
.form-actions,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.toolbar {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(15, 118, 110, 0.07)),
    #fff;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.panel {
  padding: 17px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 252, 255, 0.96)),
    var(--panel);
  border: 1px solid rgba(204, 216, 230, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.42), rgba(8, 145, 178, 0.22), rgba(201, 151, 63, 0.32));
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(216, 225, 236, 0.78);
}

.panel-title h3 {
  color: var(--ink);
  font-size: 17px;
  letter-spacing: 0;
}

.panel-title span,
.muted,
.meta,
.field span {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 13px;
  font-weight: 700;
  color: #516174;
}

.field.compact {
  width: 180px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 13px;
}

.wide {
  grid-column: 1 / -1;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.kpi {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98)),
    #fff;
  border: 1px solid rgba(205, 218, 233, 0.96);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

.kpi:nth-child(1) {
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  border-color: rgba(158, 190, 242, 0.9);
}

.kpi:nth-child(2) {
  background: linear-gradient(180deg, #ffffff, #ebfbfb);
  border-color: rgba(147, 213, 219, 0.9);
}

.kpi:nth-child(3) {
  background: linear-gradient(180deg, #ffffff, #fff6e7);
  border-color: rgba(230, 198, 139, 0.9);
}

.kpi:nth-child(4) {
  background: linear-gradient(180deg, #ffffff, #fff0f2);
  border-color: rgba(235, 166, 178, 0.9);
}

.kpi:nth-child(5) {
  background: linear-gradient(180deg, #ffffff, #edf8f2);
  border-color: rgba(154, 213, 184, 0.9);
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}

.kpi:nth-child(2)::before {
  background: linear-gradient(90deg, var(--cyan), var(--green));
}

.kpi:nth-child(3)::before {
  background: linear-gradient(90deg, var(--gold), var(--amber));
}

.kpi:nth-child(4)::before {
  background: linear-gradient(90deg, var(--rose), var(--gold));
}

.kpi:nth-child(5)::before {
  background: linear-gradient(90deg, var(--green), var(--primary));
}

.kpi strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-size: 27px;
  line-height: 1.1;
}

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

.command-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.command-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: var(--shadow-soft);
}

.command-item.high {
  border-left-color: var(--amber);
  background: linear-gradient(180deg, #ffffff, #fff8ec);
}

.command-item.hot {
  border-left-color: var(--rose);
  background: linear-gradient(180deg, #ffffff, #fff3f5);
}

.command-item span {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.command-item strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
}

.command-item p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.command-item button {
  flex: 0 0 auto;
  min-height: 32px;
  white-space: nowrap;
  box-shadow: none;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.82fr);
  gap: 16px;
}

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

.item {
  padding: 13px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 7px;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.045);
}

.item-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-weight: 800;
}

.item p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.learning-item {
  border-left: 4px solid rgba(37, 99, 235, 0.72);
}

.source-link {
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: none;
  word-break: break-all;
}

.source-link:hover {
  text-decoration: underline;
}

.sync-panel .panel-title {
  margin-bottom: 12px;
}

.sync-toolbar {
  align-items: end;
  padding: 12px;
  border-radius: 8px;
}

.calendar-toolbar {
  align-items: end;
}

.toolbar-divider {
  width: 1px;
  height: 40px;
  background: rgba(205, 218, 233, 0.95);
}

.account-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.account-filter-chip {
  display: grid;
  gap: 4px;
  min-width: 190px;
  max-width: 270px;
  min-height: 58px;
  padding: 8px 11px;
  color: var(--ink);
  text-align: left;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  border: 1px solid rgba(205, 218, 233, 0.95);
  box-shadow: var(--shadow-soft);
}

.account-filter-chip:hover {
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.09);
}

.account-filter-chip.active {
  color: #173f91;
  border-color: rgba(37, 99, 235, 0.38);
  background: linear-gradient(180deg, #f7fbff, #edf5ff);
}

.account-filter-chip strong {
  overflow: hidden;
  color: inherit;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-filter-chip small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-import-guide {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.metric-import-guide strong {
  color: var(--ink);
}

.metric-import-guide p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.header-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.header-chip {
  display: grid;
  gap: 2px;
  min-width: 128px;
  padding: 7px 9px;
  border: 1px solid rgba(197, 209, 225, 0.85);
  border-radius: 7px;
  background: #f2f6fb;
}

.header-chip.required {
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(180deg, #f7fbff, #edf5ff);
}

.header-chip strong {
  color: var(--ink);
  font-size: 13px;
}

.header-chip small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.sync-log {
  margin-top: 12px;
}

.department-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.department-stat {
  padding: 13px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.045);
}

.department-stat strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
}

.department-stat p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.user-filters {
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 8px;
}

.search-field {
  min-width: min(100%, 260px);
  flex: 1;
}

.sync-success {
  border-color: #a9ded6;
  background: linear-gradient(180deg, #f5fffb, #ecfdf8);
}

.sync-warn {
  border-color: #f4d29b;
  background: linear-gradient(180deg, #fffdf6, #fff7e8);
}

.sync-error {
  border-color: #ffc8bf;
  background: linear-gradient(180deg, #fff7f5, #ffece7);
}

.script-output strong,
.plain-text strong {
  color: var(--ink);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(197, 209, 225, 0.85);
  background: #f2f6fb;
  color: #31445f;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag {
  background: linear-gradient(180deg, #f7f9fd, #edf3fa);
}

.status.published,
.status.done {
  color: #0f766e;
  border-color: #a9ded6;
  background: linear-gradient(180deg, #ecfdf8, #dff8f1);
}

.status.hot {
  color: var(--red);
  border-color: #ffc8bf;
  background: linear-gradient(180deg, #fff6f2, #ffe8e1);
}

.status.pending {
  color: var(--amber);
  border-color: #f4d29b;
  background: linear-gradient(180deg, #fffaf0, #fff1d7);
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
}

.task {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.task input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.task span {
  line-height: 1.45;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.compact-pillars {
  grid-template-columns: 1fr;
}

.pillar {
  padding: 14px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98)),
    var(--panel-soft);
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.045);
  position: relative;
}

.pillar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(180deg, var(--primary), var(--gold));
}

.pillar strong {
  color: var(--ink);
}

.pillar p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.55;
}

.script-output {
  min-height: 280px;
  padding: 14px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbff);
  white-space: pre-wrap;
  line-height: 1.62;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.script-output pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
}

.script-output .output-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(205, 218, 233, 0.8);
}

.table-wrap {
  overflow: auto;
  max-height: 560px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.table-input {
  width: 138px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  box-shadow: none;
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.pipeline-grid + .list {
  margin-top: 12px;
}

.pipeline-column {
  min-width: 190px;
  padding: 10px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6f9fd);
}

.pipeline-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(216, 225, 236, 0.78);
}

.pipeline-head strong {
  color: var(--ink);
}

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

.pipeline-list {
  display: grid;
  gap: 9px;
}

.pipeline-item {
  padding: 10px;
  border: 1px solid rgba(205, 218, 233, 0.82);
  border-radius: 7px;
  background: #fff;
}

.pipeline-item strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
}

.pipeline-item p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 12px;
}

.pipeline-empty {
  min-height: 70px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 7px;
  background: rgba(248, 251, 255, 0.72);
  font-size: 13px;
}

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

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 12px;
}

.compare-card {
  padding: 14px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-soft);
}

.compare-card > span,
.mini-metrics span {
  color: var(--muted);
  font-size: 13px;
}

.compare-card strong {
  display: block;
  margin: 6px 0;
  color: var(--ink);
  font-size: 18px;
}

.compare-card p {
  color: var(--muted);
  line-height: 1.5;
}

.compare-card.insight {
  border-color: rgba(37, 99, 235, 0.3);
  background: linear-gradient(180deg, #ffffff, #eef5ff);
}

.diagnosis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.diagnosis-card {
  padding: 14px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-top: 4px solid var(--primary);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: var(--shadow-soft);
}

.diagnosis-card.high {
  border-top-color: var(--amber);
  background: linear-gradient(180deg, #ffffff, #fff9ee);
}

.diagnosis-card.hot {
  border-top-color: var(--rose);
  background: linear-gradient(180deg, #ffffff, #fff3f5);
}

.diagnosis-card p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.52;
  font-size: 13px;
}

.health-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
}

.health-row strong {
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.health-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mini-metrics {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.kpi-progress-card {
  min-height: 168px;
}

.progress-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  margin: 10px 0 6px;
}

.progress-line span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #0891b2, #0f766e);
}

.bar-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 68px;
  gap: 10px;
  align-items: center;
  min-height: 28px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2563eb, #0891b2, #0f766e);
}

.plain-text {
  padding: 12px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  white-space: pre-wrap;
  line-height: 1.65;
  color: var(--ink);
}

.check-list {
  display: grid;
  gap: 9px;
}

.check-line {
  padding: 10px;
  border-radius: 7px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 180px;
  max-width: 360px;
  padding: 11px 14px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  color: #fff;
  background: linear-gradient(135deg, #111827, #173f91);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-panel {
  width: min(980px, 100%);
  max-height: min(88vh, 900px);
  overflow: hidden;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.24);
}

.modal-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(205, 218, 233, 0.85);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.modal-title h3 {
  margin: 0;
  font-size: 18px;
}

.modal-body {
  max-height: calc(min(88vh, 900px) - 64px);
  overflow: auto;
  padding: 16px;
}

.modal-form {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.detail-row,
.detail-block {
  padding: 12px;
  border: 1px solid rgba(205, 218, 233, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.detail-row span {
  color: var(--muted);
  font-size: 13px;
}

.detail-row p {
  margin-top: 5px;
  color: var(--ink);
  line-height: 1.55;
}

.detail-block {
  margin-top: 10px;
}

.detail-block pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--ink);
  font-family: inherit;
}

/* Operational UI refresh and automation workspace */
body {
  background: #eef2f6;
}

.panel {
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.055);
}

.panel::before {
  display: none;
}

.nav {
  gap: 4px;
}

.nav-group-label {
  margin: 12px 10px 4px;
  color: #8392a8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.nav-group-label:first-child {
  margin-top: 0;
}

.automation-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-left: 4px solid var(--primary);
}

.automation-hero h3 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-size: 20px;
}

.automation-hero p {
  max-width: 880px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.automation-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.automation-form .panel-title {
  margin-bottom: 2px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: #334155;
  font-weight: 700;
}

.check-row input {
  width: 17px;
  min-height: 17px;
  margin: 0;
  box-shadow: none;
}

.form-note {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.automation-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.automation-stat {
  min-height: 116px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.automation-stat > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.automation-stat strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 22px;
}

.automation-stat p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.platform-video-radar {
  display: grid;
  gap: 14px;
}

.platform-integration-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.platform-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 94px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.platform-status-item > div:first-child,
.platform-watch-main,
.platform-watch-time {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.platform-status-item strong,
.platform-watch-main strong {
  color: var(--ink);
  line-height: 1.45;
}

.platform-status-item p,
.platform-watch-main p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.platform-label {
  color: #0b667b;
  font-size: 12px;
  font-weight: 800;
}

#platformWatchTotal {
  white-space: nowrap;
}

.platform-watch-form {
  display: grid;
  grid-template-columns: 120px minmax(280px, 2fr) repeat(3, minmax(145px, 0.8fr)) auto;
  align-items: end;
  gap: 10px;
}

.platform-share-field textarea {
  min-height: 64px;
}

.platform-compliance-note {
  padding: 9px 11px;
  border-left: 3px solid var(--cyan);
  background: #f0f9fb;
  color: #3f5964;
  font-size: 12px;
  line-height: 1.55;
}

.platform-watch-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.platform-watch-item {
  display: grid;
  grid-template-columns: minmax(240px, 1.7fr) minmax(150px, 0.7fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.platform-watch-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
}

.trend-card {
  display: grid;
  gap: 12px;
  min-height: 250px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.trend-card-head,
.trend-card-foot,
.automation-run {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.trend-card-head > div {
  display: grid;
  gap: 7px;
}

.trend-card-head strong {
  color: var(--ink);
  line-height: 1.5;
}

.trend-source {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.trend-score {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 32px;
  border-radius: 6px;
  background: #e8f0ff;
  color: var(--primary-dark);
  font-weight: 800;
}

.trend-card > p {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}

.trend-insight {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-left: 3px solid #0f766e;
  background: #eef9f6;
  color: #28443f;
  font-size: 13px;
  line-height: 1.55;
}

.trend-card-foot {
  align-items: center;
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
}

.format-radar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
}

.format-radar-item {
  display: grid;
  gap: 11px;
  min-height: 285px;
  padding: 15px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--cyan);
  border-radius: 8px;
  background: #fbfdff;
}

.format-radar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.format-radar-head strong {
  color: var(--primary-dark);
  font-size: 18px;
}

.format-type {
  display: inline-flex;
  width: fit-content;
  padding: 4px 7px;
  border-radius: 4px;
  background: #e7f7fa;
  color: #0b667b;
  font-size: 12px;
  font-weight: 800;
}

.format-radar-item h4,
.media-library-heading h4 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.format-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.format-facts > div {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.format-facts dt {
  color: var(--muted);
  font-weight: 800;
}

.format-facts dd {
  margin: 0;
  color: #334155;
}

.format-disclaimer {
  margin: auto 0 0;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
}

.media-center {
  display: grid;
  gap: 14px;
}

.media-search-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(120px, 0.75fr)) auto;
  align-items: end;
  gap: 10px;
}

.media-provider-status {
  min-height: 22px;
  padding: 8px 10px;
  border-left: 3px solid var(--cyan);
  background: #f0f9fb;
  color: #3f5964;
  font-size: 12px;
  line-height: 1.5;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
}

.media-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.media-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e8eef5;
}

.media-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-preview-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.media-type {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.media-card-body {
  display: grid;
  gap: 7px;
  padding: 12px;
}

.media-card-body strong {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.media-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.media-modal-content {
  display: grid;
  gap: 14px;
}

.media-modal-player {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 280px;
  max-height: 62vh;
  overflow: hidden;
  border-radius: 8px;
  background: #0f172a;
}

.media-modal-player video,
.media-modal-player img {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
  background: #0f172a;
}

.media-modal-player.image {
  background: #e8eef5;
}

.media-modal-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.media-preview-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--cyan);
  background: #f0f9fb;
  color: #3f5964;
  line-height: 1.5;
}

.media-modal-actions {
  justify-content: flex-end;
}

.media-library-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.media-library-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.manual-media-form {
  display: grid;
  grid-template-columns: 130px minmax(180px, 1fr) minmax(260px, 2fr) minmax(200px, 1fr) minmax(170px, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.button-link.ghost {
  border: 1px solid #c5d8f7;
  background: #f1f6ff;
  color: var(--primary-dark);
}

.automation-run-list {
  display: grid;
  gap: 8px;
}

.automation-run {
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid #0f766e;
  border-radius: 6px;
  background: #fbfcfe;
}

.automation-run.error {
  border-left-color: var(--red);
}

.automation-run.running {
  border-left-color: var(--amber);
}

.automation-run p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.lead-newest td {
  background: #f1f8ff;
}

.lead-newest td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
}

.newest-label {
  display: inline-flex;
  margin-top: 5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dff8f1;
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .nav-group-label {
    grid-column: 1 / -1;
  }

  .side-actions {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .form-grid,
  .command-grid,
  .kpi-grid,
  .task-grid,
  .pillar-grid,
  .compare-grid,
  .diagnosis-grid,
  .detail-grid,
  .modal-form,
  .two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-import-guide {
    grid-template-columns: 1fr;
  }

  .toolbar-divider {
    display: none;
  }

  .pipeline-grid {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
  }

  .automation-stats,
  .trend-grid,
  .format-radar-grid,
  .media-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .media-search-toolbar,
  .manual-media-form,
  .platform-watch-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .platform-share-field {
    grid-column: span 2;
  }
}

@media (min-width: 901px) and (max-width: 1080px) {
  .app {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    height: 100vh;
  }

  .nav,
  .side-actions {
    grid-template-columns: 1fr;
  }

  .nav-group-label {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  html,
  body,
  .app {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

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

  .sidebar,
  .main {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .sidebar {
    gap: 10px;
    padding: 14px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .nav {
    display: flex;
    gap: 6px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    padding: 2px 0 8px;
    scrollbar-width: thin;
  }

  .nav-group-label {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 36px;
    padding: 0 11px;
    white-space: nowrap;
  }

  .side-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 0;
  }

  .user-card {
    grid-column: 1 / -1;
  }

  .main {
    padding: 12px;
  }

  .main-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions,
  .header-actions button,
  .toolbar,
  .toolbar button,
  .field.compact,
  .account-filter-chip {
    width: 100%;
    max-width: none;
  }

  .nav,
  .form-grid,
  .command-grid,
  .kpi-grid,
  .task-grid,
  .pillar-grid,
  .compare-grid,
  .diagnosis-grid,
  .detail-grid,
  .modal-form,
  .two-col {
    grid-template-columns: 1fr;
  }

  .command-item {
    display: grid;
  }

  .pipeline-grid {
    grid-template-columns: minmax(220px, 1fr);
  }

  .automation-hero,
  .automation-hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .automation-stats,
  .trend-grid,
  .format-radar-grid,
  .media-grid,
  .media-search-toolbar,
  .manual-media-form,
  .platform-integration-status,
  .platform-watch-form,
  .platform-watch-item {
    grid-template-columns: 1fr;
  }

  .platform-share-field {
    grid-column: auto;
  }

  .platform-status-item {
    align-items: stretch;
    flex-direction: column;
  }

  .platform-watch-item {
    align-items: stretch;
  }

  .media-modal-player {
    min-height: 180px;
  }

  .media-modal-meta {
    grid-template-columns: 1fr;
  }
}
