:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dde5ef;
  --text: #142033;
  --muted: #6c788b;
  --brand: #1f6feb;
  --brand-2: #0f9f7a;
  --warn: #b65c00;
  --danger: #c73636;
  --shadow: 0 18px 42px rgba(25, 38, 64, 0.10);
}

.rich-editor {
  min-height: 180px;
  padding: 14px;
  border: 1px solid #dfe6e2;
  border-radius: 12px;
  background: #fff;
  line-height: 1.7;
  overflow: auto;
}

.rich-editor img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
  border-radius: 8px;
}

.rich-editor[data-placeholder]:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

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

.rich-text-select {
  width: auto;
  min-width: 92px;
  padding: 8px 10px;
}

.rich-text-color {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 7px;
  background: #eef3fa;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.rich-text-color input[type="color"] {
  width: 28px;
  height: 24px;
  padding: 0;
  border: 0;
}

.rich-upload {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.rich-upload input {
  display: none;
}

.cover-preview {
  min-height: 128px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: #f8fafc;
}

.cover-preview img {
  display: block;
  width: min(360px, 100%);
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
}

.detail-image-preview img {
  width: min(420px, 100%);
  height: 210px;
  max-height: none;
}

.agent-activity-table-wrap {
  position: relative;
}

.agent-activity-table {
  min-width: 1320px;
}

.agent-activity-table th,
.agent-activity-table td {
  white-space: nowrap;
}

.agent-activity-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-activity-thumb {
  width: 52px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
}

.agent-activity-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 230px;
  background: #fff;
  box-shadow: -8px 0 12px rgba(15, 23, 42, 0.05);
}

.form-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

textarea {
  width: 100%;
  border: 1px solid #dfe6e2;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.brand h1 {
  margin: 0;
  font-size: 22px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

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

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus {
  outline: 2px solid rgba(31, 111, 235, 0.18);
  border-color: var(--brand);
}

.password-mask {
  -webkit-text-security: disc;
}

.button, .ghost, .danger {
  min-height: 38px;
  border-radius: 7px;
  padding: 9px 14px;
  font-weight: 750;
}

.button:disabled, .ghost:disabled, .danger:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.button {
  background: var(--brand);
  color: #fff;
}

.ghost {
  background: #eef3fa;
  color: var(--text);
}

.danger {
  background: #fff1f1;
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: #10233d;
  color: #dce8f7;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  margin-bottom: 28px;
}

.sidebar .brand h1 { color: #fff; }
.sidebar .brand p { color: #a8bbd5; }

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

.nav button {
  width: 100%;
  text-align: left;
  border-radius: 7px;
  padding: 11px 12px;
  color: #dce8f7;
  background: transparent;
}

.nav button.active, .nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

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

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

.topbar h2 {
  margin: 0;
  font-size: 24px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(20, 32, 51, 0.06);
}

.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-head h3 {
  margin: 0;
  font-size: 17px;
}

.panel-body {
  padding: 18px;
}

.metric {
  padding: 16px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

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

.toolbar .field {
  min-width: 180px;
  margin: 0;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #f8fafc;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

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

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  pointer-events: none;
  background: #10233d;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 35, 61, 0.44);
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 19px;
}

.modal-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-body {
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.form-grid .field {
  margin: 0;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
  }
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .main {
    padding: 16px;
  }
  .grid.cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  .grid.cols, .nav {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-bar .field {
  min-width: 180px;
  margin: 0;
}

.summary-line {
  margin: 0 0 14px;
  color: var(--text);
}
