* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13px;
  color: #222;
  background: #e8eef5;
}

a {
  color: #1a5fb4;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.sidebar {
  background: #f7f9fc;
  border-right: 1px solid #c5d0de;
  overflow-y: auto;
}

.sidebar-title {
  padding: 10px 12px;
  font-weight: 700;
  color: #1f4e79;
  border-bottom: 1px solid #c5d0de;
  background: linear-gradient(180deg, #f3f7fb, #e7eef6);
  position: sticky;
  top: 0;
  z-index: 2;
}

.menu details {
  border-bottom: 1px solid #dde5ef;
}

.menu summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  color: #2b4d6f;
  font-weight: 600;
  background: #eef3f9;
  user-select: none;
}

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

.menu summary::before {
  content: "▶";
  display: inline-block;
  width: 14px;
  font-size: 10px;
  color: #6a839e;
  transform: translateY(-1px);
}

.menu details[open] > summary::before {
  content: "▼";
}

.menu ul {
  margin: 0;
  padding: 0;
  list-style: none;
  background: #fff;
}

.menu li a {
  display: block;
  padding: 7px 12px 7px 28px;
  color: #334;
  border-left: 3px solid transparent;
}

.menu li a:hover {
  background: #f0f6ff;
  text-decoration: none;
}

.menu li.active a {
  background: #dceaff;
  color: #0b57a8;
  border-left-color: #0b57a8;
  font-weight: 600;
}

.main {
  padding: 12px 16px 24px;
  background: #fff;
  overflow-y: auto;
  min-width: 0;
}

.breadcrumb {
  margin-bottom: 12px;
  color: #555;
}

.panel {
  border: 1px solid #c9d5e4;
  background: #fafcfe;
  padding: 16px 16px 20px;
}

.panel + .panel {
  margin-top: 12px;
}

.panel-title {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d7e1ec;
  color: #1f4e79;
  font-size: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.field-row.compact {
  margin-bottom: 10px;
}

.field-label {
  text-align: right;
  padding-top: 6px;
  color: #333;
  white-space: nowrap;
}

.field-body textarea,
.field-body input[type="text"],
.field-body input[type="password"],
.field-body input[type="number"],
.field-body input[type="datetime-local"],
.field-body input[type="date"],
.field-body input[type="file"],
.field-body select {
  width: 100%;
  max-width: 100%;
  border: 1px solid #9eb0c5;
  border-radius: 2px;
  padding: 7px 8px;
  font: inherit;
  background: #fff;
  outline: none;
}

.field-body textarea:focus,
.field-body input:focus,
.field-body select:focus {
  border-color: #3b82c4;
  box-shadow: 0 0 0 2px rgba(59, 130, 196, 0.15);
}

.input-sm {
  width: 220px !important;
}

.content-toolbar,
.toolbar,
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.content-toolbar {
  margin-top: 8px;
}

.filter-bar {
  margin-bottom: 12px;
  padding: 10px;
  background: #f3f7fb;
  border: 1px solid #d7e1ec;
}

.filter-bar label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.filter-bar input,
.filter-bar select {
  border: 1px solid #9eb0c5;
  border-radius: 2px;
  padding: 4px 6px;
  font: inherit;
  background: #fff;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
  color: #444;
}

.meta-row strong {
  color: #c0392b;
}

.schedule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.schedule-row input {
  width: 220px;
}

.hint {
  color: #888;
}

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

.btn-group.wrap {
  margin-top: 8px;
}

.btn {
  appearance: none;
  border: 1px solid #8aa0b8;
  background: linear-gradient(180deg, #f8fbff, #e4ecf5);
  color: #243447;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  line-height: 1.4;
}

.btn:hover {
  background: linear-gradient(180deg, #ffffff, #dce7f3);
}

.btn:active {
  background: #d5e0ec;
}

.btn-primary {
  border-color: #2f6fad;
  background: linear-gradient(180deg, #4f97d8, #2f6fad);
  color: #fff;
  min-width: 88px;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #5aa3e4, #3578b8);
}

.btn-danger {
  border-color: #b85c5c;
  background: linear-gradient(180deg, #f6d6d6, #e8b4b4);
  color: #7a1f1f;
}

.btn-link {
  border: none;
  background: none;
  color: #1a5fb4;
  padding: 0 4px;
  cursor: pointer;
  font: inherit;
}

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

.actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding-top: 8px;
}

.notice {
  background: #f7f9fc;
  border-left: 1px solid #c5d0de;
  padding: 14px 16px;
  color: #333;
  overflow-y: auto;
}

.notice.hidden {
  display: none;
}

.notice h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #1f4e79;
}

.notice ol {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.channel {
  margin-top: 18px;
  padding: 10px;
  border: 1px dashed #9eb0c5;
  background: #fff;
  line-height: 1.6;
}

.status-bar {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #dfe7f0;
  border-top: 1px solid #c5d0de;
  color: #445;
}

.status-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.logout-btn {
  color: #1a5fb4;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 4px;
  z-index: 40;
  max-width: min(520px, 90vw);
  text-align: center;
}

.send-progress {
  padding: 8px 4px 4px;
}

.send-progress-tip {
  margin: 0 0 14px;
  color: #445;
  text-align: center;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e4ebf3;
  overflow: hidden;
  border: 1px solid #c9d5e4;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f97d8, #2f6fad);
  transition: width 0.08s linear;
}

.progress-percent {
  margin-top: 10px;
  text-align: center;
  color: #1f4e79;
  font-weight: 700;
  font-size: 16px;
}

.send-result {
  display: grid;
  gap: 10px;
}

.send-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #f5f8fc;
  border: 1px solid #d7e1ec;
  border-radius: 4px;
}

.send-result-row.ok strong {
  color: #1f7a34;
}

.send-result-row.fail strong {
  color: #b42318;
}

.send-result-hint {
  margin: 4px 0 0;
  color: #889;
  font-size: 12px;
  line-height: 1.5;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #c9d5e4;
  background: #fff;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

table.data th,
table.data td {
  border-bottom: 1px solid #e1e8f0;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

table.data th {
  background: #eef3f9;
  color: #1f4e79;
  font-weight: 600;
}

table.data tr:hover td {
  background: #f5f9ff;
}

table.data .center {
  text-align: center;
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
}

.tag-ok {
  background: #e7f7ea;
  color: #1f7a34;
}

.tag-fail {
  background: #fde8e8;
  color: #b42318;
}

.tag-wait {
  background: #fff4d6;
  color: #8a5b00;
}

.tag-info {
  background: #e8f1fb;
  color: #1a5fb4;
}

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

.stat-card {
  border: 1px solid #c9d5e4;
  background: linear-gradient(180deg, #fff, #f3f7fb);
  padding: 14px;
}

.stat-card .label {
  color: #667;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 22px;
  color: #1f4e79;
  font-weight: 700;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.empty-box {
  padding: 28px;
  text-align: center;
  color: #889;
  border: 1px dashed #c9d5e4;
  background: #fff;
}

.security-doc {
  line-height: 1.8;
  background: #fff;
  border: 1px solid #c9d5e4;
  padding: 16px 18px;
}

.security-doc h4 {
  margin: 16px 0 8px;
  color: #1f4e79;
}

.security-doc h4:first-child {
  margin-top: 0;
}

.preview-box {
  min-height: 80px;
  border: 1px solid #c9d5e4;
  background: #fff;
  padding: 10px;
  white-space: pre-wrap;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.modal-card {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  margin: 12vh auto 0;
  background: #fff;
  border: 1px solid #9eb0c5;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #eef3f9;
  border-bottom: 1px solid #d7e1ec;
}

.modal-foot {
  justify-content: flex-end;
  gap: 8px;
  border-bottom: none;
  border-top: 1px solid #d7e1ec;
}

.modal-body {
  padding: 14px;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  color: #556;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.form-grid .row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  align-items: center;
}

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

@media (max-width: 1100px) {
  .app,
  .app.wide-main {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .notice {
    display: none;
  }

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

@media (max-width: 760px) {
  .app,
  .app.wide-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    max-height: 220px;
  }

  .field-row,
  .form-grid .row {
    grid-template-columns: 1fr;
  }

  .field-label {
    text-align: left;
    padding-top: 0;
  }

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