:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --line: #d9e1ec;
  --text: #17202c;
  --muted: #667085;
  --accent: #0f62fe;
  --accent-dark: #004bd6;
  --danger: #d92d20;
  --warn: #b54708;
  --ok: #067647;
  --shadow: 0 14px 34px rgba(16, 24, 40, 0.08);
  --soft-shadow: 0 8px 20px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #f8fbff 0, #f3f6fb 260px),
    var(--bg);
}

body.auth-pending #loginView,
body.auth-pending #appView {
  display: none !important;
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: var(--accent-dark);
}

button:active {
  transform: translateY(1px);
}

button.secondary,
.panel-head button,
.table-tools button {
  background: #edf2f7;
  color: var(--text);
}

button.secondary:hover,
.panel-head button:hover,
.table-tools button:hover {
  background: #dfe7f2;
}

button.primary-action {
  min-width: 124px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(15, 98, 254, 0.24);
}

button.primary-action:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 22px rgba(15, 98, 254, 0.30);
}

.panel-head button.primary-action {
  background: var(--accent);
  color: #fff;
}

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

button.link-button {
  background: transparent;
  color: var(--accent);
  padding: 0;
  box-shadow: none;
  font-weight: 700;
  text-align: left;
}

button.link-button:hover {
  background: transparent;
  color: var(--accent-dark);
  text-decoration: underline;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

label span,
.field-title {
  color: var(--muted);
  font-size: 13px;
}

.danger-text {
  color: var(--danger) !important;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(22, 119, 255, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(6, 118, 71, 0.10), transparent 30%),
    var(--bg);
}

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

.login-panel h1 {
  margin: 0;
  font-size: 28px;
}

.login-panel p,
.login-panel small {
  margin: 0;
  color: var(--muted);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.32), transparent 28%),
    linear-gradient(135deg, #0f62fe 0, #143c8f 55%, #101828 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 98, 254, 0.26);
}

.brand-mark svg {
  width: 31px;
  height: 31px;
  display: block;
}

.form-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

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

.sidebar {
  background:
    linear-gradient(180deg, #111827 0, #172033 100%);
  color: #fff;
  padding: 20px 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  box-shadow: 8px 0 24px rgba(16, 24, 40, 0.10);
}

.product {
  display: flex;
  gap: 12px;
  align-items: center;
}

.product strong {
  display: block;
  font-size: 18px;
}

.product span {
  display: block;
  color: #9ca3af;
  font-size: 12px;
}

nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.nav-item {
  background: transparent;
  color: #d1d5db;
  text-align: left;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: currentColor;
  opacity: 0.82;
}

.nav-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover,
.nav-item.active {
  background: #253246;
  color: #fff;
}

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item.active svg {
  opacity: 1;
}

.main {
  min-width: 0;
  padding: 24px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 20px;
}

.topbar {
  min-height: 74px;
  padding: 4px 2px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

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

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.user-menu span {
  max-width: 160px;
  min-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
  text-align: right;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.summary-row {
  min-height: 86px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: center;
  gap: 8px;
}

.summary-row:last-child {
  border-right: 0;
}

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

.summary-row strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.content-grid,
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.split {
  grid-template-columns: minmax(320px, 420px) 1fr;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
  box-shadow: var(--soft-shadow);
}

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

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

.list,
.stat-list,
.entity-list,
.form-panel {
  padding: 16px;
}

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

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.list-item:hover {
  border-color: #b9c7dc;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
  transform: translateY(-1px);
}

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

.list-item strong {
  display: block;
  margin-bottom: 6px;
}

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

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.wechat-bind-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 14px;
}

.wechat-bind-box > div {
  min-width: 0;
}

.wechat-bind-box strong {
  display: block;
  margin-bottom: 4px;
}

.wechat-bind-box p,
.wechat-qr-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.wechat-callback-info {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.6fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
}

.wechat-callback-info > div {
  min-width: 0;
}

.wechat-callback-info span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.wechat-callback-info strong {
  display: block;
  overflow-wrap: anywhere;
}

.wechat-callback-info small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.55;
}

.wechat-callback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.recipient-edit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.recipient-edit-form input {
  min-width: 0;
}

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

.recipient-list-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px 16px;
  text-align: center;
}

.recipient-item {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  min-width: 0;
}

.recipient-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.recipient-main > div,
.recipient-openid {
  min-width: 0;
}

.recipient-main strong {
  display: block;
  overflow-wrap: anywhere;
}

.recipient-openid {
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #f8fbff;
}

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

.recipient-openid strong {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.recipient-actions {
  justify-content: flex-end;
  min-width: 0;
}

.recipient-item .recipient-edit-form {
  grid-column: 1 / -1;
  margin-top: 0;
}

.wechat-qr-box {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid #b9c7dc;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.wechat-qr-box > div {
  min-width: 0;
}

.wechat-qr-box img {
  width: 164px;
  height: 164px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.wechat-qr-box a {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(260px, 1.5fr) auto auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.inline-form button {
  min-width: 96px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #eef2f7;
  color: #344054;
}

.pill.critical {
  background: #fee4e2;
  color: #b42318;
}

.pill.major {
  background: #ffead5;
  color: #b54708;
}

.pill.warning {
  background: #fef0c7;
  color: #93370d;
}

.pill.info {
  background: #d1e9ff;
  color: #175cd3;
}

.pill.open {
  background: #fee4e2;
  color: #b42318;
}

.pill.ack {
  background: #fef0c7;
  color: #93370d;
}

.pill.closed,
.pill.enabled {
  background: #dcfae6;
  color: #067647;
}

.pill.disabled {
  background: #f2f4f7;
  color: #667085;
}

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

.stat-row {
  display: grid;
  grid-template-columns: 90px 1fr 38px;
  align-items: center;
  gap: 10px;
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: #e4e7ec;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.table-tools select,
.table-tools input {
  width: 170px;
}

.table-wrap {
  overflow-x: auto;
}

.pagination-bar {
  min-height: 54px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-actions select {
  width: 128px;
}

.pagination-actions button {
  min-width: 82px;
}

.pagination-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.entity-table {
  min-width: 760px;
}

.apps-table {
  min-width: 1160px;
}

.channels-table {
  min-width: 880px;
}

.users-table {
  min-width: 680px;
}

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

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

th {
  color: var(--muted);
  background: #f8fafc;
  font-weight: 600;
}

tbody tr:hover {
  background: #f8fbff;
}

.entity-table td:first-child strong {
  display: block;
  margin-bottom: 4px;
}

.subtext {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.secret-cell,
.openid-cell {
  max-width: 260px;
}

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

.row-actions .primary-action {
  min-width: 0;
  padding: 9px 14px;
}

.empty-cell {
  padding: 18px 16px;
  text-align: center;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.check-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check-list input {
  width: auto;
}

.app-channel-list {
  display: grid;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.app-detail-summary {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.app-detail-summary div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 11px 12px;
}

.app-detail-summary div:last-child {
  border-bottom: 0;
}

.app-detail-summary span {
  color: var(--muted);
  font-size: 12px;
}

.app-detail-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.runtime-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 12px 12px;
}

.runtime-list div {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.openid-cell {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.runtime-list div:last-child {
  border-bottom: 0;
}

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

.runtime-list strong {
  overflow-wrap: anywhere;
}

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

.settings-form .modal-actions {
  grid-column: 1 / -1;
}

.report-summary {
  margin: 12px;
}

.report-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.report-block h4 {
  margin: 0;
}

.detail-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.timeline-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.timeline-list div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

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

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

.timeline-list strong {
  font-size: 14px;
}

.timeline-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.detail-section p {
  margin: 4px 0 0;
  line-height: 1.55;
}

.category-editor {
  display: grid;
  gap: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #b9c7dc;
  border-radius: 999px;
  background: #f8fbff;
  padding: 6px 8px 6px 12px;
  font-size: 13px;
}

.tag button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  padding: 0;
  background: #e4e7ec;
  color: var(--text);
  line-height: 1;
}

.tag button:hover {
  background: #d0d5dd;
}

.inline-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.template-editor {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
}

.template-editor-head,
.template-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.template-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.template-item {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

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

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

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

.app-channel-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.app-channel-row:last-child {
  border-bottom: 0;
}

.app-channel-main {
  display: grid;
  align-content: start;
  gap: 6px;
}

.app-channel-options {
  display: grid;
  gap: 10px;
}

.option-line {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.recipient-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.recipient-check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.recipient-check-list input {
  width: auto;
}

.app-channel-options small {
  color: var(--muted);
}

.muted-disabled {
  opacity: 0.55;
}

dialog {
  border: 0;
  padding: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.modal-card {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  background: var(--panel);
  display: grid;
  gap: 14px;
  padding: 0 16px 16px;
}

.compact-modal {
  width: min(460px, calc(100vw - 28px));
}

.wide-modal {
  width: min(860px, calc(100vw - 28px));
}

.people-modal {
  width: min(1040px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  overflow-x: hidden;
}

.media-preview-modal {
  width: min(1080px, calc(100vw - 28px));
}

.alert-detail-body {
  display: grid;
  gap: 16px;
  padding-bottom: 4px;
}

.detail-grid {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  overflow: hidden;
}

.detail-grid div,
.kv-list div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbff;
  padding: 11px 12px;
  min-width: 0;
}

.detail-grid div:last-child,
.kv-list div:last-child {
  border-bottom: 0;
}

.detail-grid span,
.kv-list span {
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong,
.kv-list strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-block {
  display: grid;
  gap: 8px;
}

.detail-block h4 {
  margin: 0;
  font-size: 14px;
}

.collapsible-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.collapsible-detail summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.collapsible-detail summary::-webkit-details-marker {
  display: none;
}

.collapsible-detail summary::after {
  content: "展开";
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.collapsible-detail[open] summary {
  border-bottom: 1px solid var(--line);
}

.collapsible-detail[open] summary::after {
  content: "收起";
}

.collapsible-detail summary span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.collapsible-detail summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.collapsible-detail .kv-list {
  border-radius: 0;
}

.detail-block p {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
}

.media-list,
.kv-list {
  display: grid;
}

.media-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.media-list a {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  text-decoration: none;
  align-items: center;
}

.media-list a:last-child {
  border-bottom: 0;
}

.media-list a:hover {
  background: #f8fbff;
}

.media-list span,
.media-list small {
  color: var(--muted);
  font-size: 12px;
}

.media-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

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

.media-preview-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  max-height: 420px;
  background: #0f172a;
  color: #fff;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  cursor: zoom-in;
}

.media-preview-frame img,
.media-preview-frame video {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.media-load-failed .media-preview-frame::after {
  content: "图片加载失败，请打开原图查看";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #f8fbff;
  color: var(--muted);
  text-align: center;
}

.media-load-failed .media-preview-frame img {
  visibility: hidden;
}

.media-preview-meta {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.media-preview-meta span,
.media-preview-meta small {
  color: var(--muted);
  font-size: 12px;
}

.media-preview-meta strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.media-preview-meta button {
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.media-preview-dialog-body {
  display: grid;
  place-items: center;
  min-height: min(70vh, 680px);
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
}

.media-preview-dialog-body img,
.media-preview-dialog-body video {
  display: block;
  max-width: 100%;
  max-height: min(76vh, 760px);
  object-fit: contain;
}

.push-results {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.push-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid #98a2b3;
  background: #fff;
  padding: 11px 12px;
}

.push-result:last-child {
  border-bottom: 0;
}

.push-result.success {
  border-left-color: var(--ok);
}

.push-result.failed {
  border-left-color: var(--danger);
}

.push-result strong {
  display: block;
}

.push-result span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.push-result p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.doc-page {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.doc-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 16px;
}

.doc-hero span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.doc-hero h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.doc-hero p,
.doc-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.doc-copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-info-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.doc-info-list div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.doc-info-list div:last-child {
  border-bottom: 0;
}

.doc-info-list span {
  color: var(--muted);
  font-size: 12px;
}

.doc-info-list strong {
  display: block;
  overflow-wrap: anywhere;
}

.doc-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.doc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.doc-section h4,
.doc-section-head h4 {
  margin: 0;
  font-size: 15px;
}

.doc-section pre {
  margin: 0;
  overflow: auto;
  border-radius: 8px;
  background: #101828;
  color: #e4e7ec;
  padding: 14px;
  line-height: 1.55;
}

.doc-section code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.field-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.field-table div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.field-table div:last-child {
  border-bottom: 0;
}

.field-table strong {
  font-family: Consolas, "Courier New", monospace;
}

.field-table span {
  color: var(--muted);
}

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

.modal-actions button:first-child {
  background: #edf2f7;
  color: var(--text);
}

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

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

  .sidebar {
    position: static;
    grid-template-rows: auto auto auto;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    padding: 9px 6px;
    gap: 6px;
  }

  .nav-item svg {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }

  .summary-list,
  .content-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .summary-row {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-row:last-child {
    border-bottom: 0;
  }

  .people-modal {
    width: min(940px, calc(100vw - 28px));
  }

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

  .recipient-actions {
    justify-content: flex-start;
  }

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

  .inline-form .check-row,
  .inline-form button {
    align-self: end;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .top-actions button {
    flex: 1;
  }

  .table-tools select,
  .table-tools input,
  .table-tools button {
    width: 100%;
  }

  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pagination-actions select {
    grid-column: 1 / -1;
    width: 100%;
  }

  .user-menu {
    width: 100%;
    padding-left: 0;
    border-left: 0;
  }

  .user-menu span {
    text-align: left;
    flex: 1 1 100%;
    max-width: none;
  }

  .user-menu button {
    flex: 1;
  }

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

  .detail-grid div,
  .kv-list div,
  .media-list a {
    grid-template-columns: 1fr;
  }

  .app-detail-summary div {
    grid-template-columns: 1fr;
  }

  .push-result {
    grid-template-columns: 1fr;
  }

  .wechat-bind-box,
  .wechat-qr-box {
    align-items: stretch;
    flex-direction: column;
  }

  .wechat-callback-info {
    grid-template-columns: 1fr;
  }

  .wechat-callback-actions {
    justify-content: flex-start;
  }

  .recipient-edit-form {
    grid-template-columns: 1fr;
  }

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

  .recipient-actions button {
    flex: 1;
  }

  .wechat-qr-box img {
    width: 100%;
    height: auto;
    max-width: 220px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .inline-add {
    grid-template-columns: 1fr;
  }

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

  .doc-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .app-channel-row,
  .option-line,
  .doc-info-list div,
  .field-table div {
    grid-template-columns: 1fr;
  }
}
