/**
 * 管理后台样式。不依赖任何 UI 框架与构建工具，
 * 需要的表格、弹窗、表单、标签都在这里手写，浏览器直接加载。
 */
:root {
  --bg: #f2f8f5;
  --panel: #ffffff;
  --border: #ddede4;
  --text: #1e2b25;
  --muted: #6b7c73;
  --primary: #0f8a5b;
  --primary-dark: #0c7047;
  --primary-soft: #e8f6ef;
  --danger: #d64f3f;
  --success: #2e9e5b;
  --warning: #d99117;
  --info: #6b7684;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(18, 48, 36, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

#app {
  height: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
}

/* ---------------- 布局 */
.layout {
  display: flex;
  height: 100%;
}

.aside {
  width: 220px;
  flex-shrink: 0;
  background: #ffffff;
  color: #3b4a42;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.aside__brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid #e6f1eb;
}

.aside__title {
  font-size: 18px;
  font-weight: 700;
  color: #0c7c52;
  letter-spacing: 2px;
}

.aside__sub {
  margin-top: 6px;
  font-size: 12px;
  color: #8a9a91;
}

.aside__menu {
  padding: 10px 0;
  flex: 1;
}

.aside__item {
  display: block;
  padding: 11px 22px;
  color: #3b4a42;
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.aside__item:hover {
  background: #f2f8f5;
  color: #0f8a5b;
}

.aside__item--on {
  background: #e4f6ec;
  border-left-color: #0f8a5b;
  color: #0c7c52;
  font-weight: 600;
}

.aside__foot {
  padding: 14px 20px 18px;
  font-size: 12px;
  color: #8a9a91;
  border-top: 1px solid #e6f1eb;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.header {
  height: 56px;
  flex-shrink: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
}

.header__title {
  font-size: 16px;
  font-weight: 600;
}

.header__right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

/* ---------------- 卡片与栅格 */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card__title {
  font-size: 15px;
  font-weight: 600;
}

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

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

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

.stat__value {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
}

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

/* ---------------- 表单控件 */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.input,
.select,
.textarea {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.textarea {
  height: auto;
  padding: 8px 10px;
  line-height: 1.6;
  width: 100%;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
}

.input--w160 { width: 160px; }
.input--w200 { width: 200px; }
.input--w240 { width: 240px; }
.input--full { width: 100%; }

.btn {
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn--primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn--danger {
  color: var(--danger);
  border-color: rgba(214, 79, 63, 0.4);
}

.btn--danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
}

.btn--link {
  height: auto;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
}

.btn--link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.btn--link.btn--danger {
  color: var(--danger);
  border: none;
  background: none;
}

.btn--link.btn--danger:hover {
  background: none;
  color: #a53628;
}

.field {
  margin-bottom: 14px;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field__label--req::before {
  content: '*';
  color: var(--danger);
  margin-right: 4px;
}

.field__row {
  display: flex;
  gap: 12px;
}

.field__row > .field {
  flex: 1;
  min-width: 0;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}

/* ---------------- 表格 */
.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  background: #fafbfc;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.table tbody tr:hover {
  background: #f4faf7;
}

.table__empty {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

.table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: #eef3f0;
  cursor: pointer;
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 18px;
  background: #eef0f3;
  color: var(--info);
  white-space: nowrap;
}

.tag--success { background: #e8f5ec; color: var(--success); }
.tag--warning { background: #fdf3e2; color: var(--warning); }
.tag--danger { background: #fbeceb; color: var(--danger); }
.tag--primary { background: var(--primary-soft); color: var(--primary); }
.tag--info { background: #eef0f3; color: var(--info); }

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

.mono {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

/* ---------------- 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------------- 弹窗 */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 40, 30, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px;
  overflow-y: auto;
  z-index: 900;
}

.dialog {
  background: var(--panel);
  border-radius: 10px;
  box-shadow: var(--shadow);
  width: 560px;
  max-width: 100%;
}

.dialog--wide {
  width: 860px;
}

.dialog__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
}

.dialog__close {
  cursor: pointer;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.dialog__body {
  padding: 18px 20px;
  max-height: 62vh;
  overflow-y: auto;
}

.dialog__foot {
  padding: 12px 20px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------------- 消息提示 */
.toasts {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13px;
  box-shadow: var(--shadow);
  background: #fff;
  border: 1px solid var(--border);
}

.toast--success { background: #e8f5ec; border-color: #b9e0c7; color: #1e6b3c; }
.toast--error { background: #fbeceb; border-color: #f0c4bf; color: #9c2f22; }
.toast--warning { background: #fdf3e2; border-color: #f0dcb2; color: #8a5c10; }

/* ---------------- 登录页 */
.login {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, #e6f6ee, #f7fbf9 55%, #d9f0e5);
}

.login__box {
  width: 380px;
  max-width: 92%;
  background: var(--panel);
  border-radius: 12px;
  padding: 34px 32px 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.login__title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
  letter-spacing: 3px;
}

.login__sub {
  margin: 8px 0 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.login__input {
  width: 100%;
  height: 40px;
  margin-bottom: 14px;
}

.login__btn {
  width: 100%;
  height: 40px;
  margin-top: 6px;
}

.login__tip {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

.loading,
.error-box {
  padding: 50px 0;
  text-align: center;
  color: var(--muted);
}

.error-box {
  color: var(--danger);
}

/* ---------- 确认框补充 ---------- */
.confirm__text {
  font-size: 14px;
  line-height: 1.8;
  color: #303540;
  white-space: pre-wrap;
}

.confirm__hint {
  margin: 14px 0 8px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fdf6e6;
  border: 1px solid #f0dfb4;
  color: #8a6a12;
  font-size: 13px;
  line-height: 1.7;
}

.toast--out {
  opacity: 0;
  transform: translateY(-8px);
}

/* ---------- 布局补充 ---------- */
.boot {
  padding: 60px 0;
  text-align: center;
  color: #8a8f99;
  font-size: 14px;
}

.bare {
  min-height: 100vh;
}

.aside--mini {
  width: 68px;
}

.aside--mini .aside__item {
  padding-left: 0;
  text-align: center;
}

.header__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header__crumb {
  font-size: 16px;
  font-weight: 600;
  color: #232833;
}

.header__user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: #303540;
}

.header__caret {
  color: #98a0ad;
  font-size: 12px;
}

.dropdown {
  position: absolute;
  top: 50px;
  right: 20px;
  z-index: 30;
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 24, 32, 0.12);
  overflow: hidden;
}

.dropdown__item {
  padding: 10px 16px;
  font-size: 13px;
  color: #303540;
  cursor: pointer;
}

.dropdown__item:hover {
  background: #eef7f2;
  color: var(--primary);
}

.header {
  position: relative;
}

/* ---------- 看板图表 ---------- */
.head-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.head-card__name {
  font-size: 16px;
  font-weight: 600;
  margin-right: 8px;
}

.head-card__countdown {
  font-size: 14px;
  color: var(--primary);
  font-weight: 600;
}

.stat__value--warn {
  color: var(--danger);
}

.spark {
  display: block;
  width: 100%;
  height: 160px;
}

.spark__line {
  fill: none;
  stroke: #0f8a5b;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}

.spark__area {
  fill: rgba(15, 138, 91, 0.14);
  stroke: none;
}

.spark--blue .spark__line {
  stroke: #2f6fd0;
}

.spark--blue .spark__area {
  fill: rgba(47, 111, 208, 0.12);
}

.spark__axis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: #8a8f99;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar__label {
  width: 82px;
  flex-shrink: 0;
  color: #4a5060;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar__track {
  flex: 1;
  height: 12px;
  border-radius: 6px;
  background: #e6f1eb;
  overflow: hidden;
}

.bar__fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #3fc98f, #0f8a5b);
}

.bar__value {
  width: 56px;
  flex-shrink: 0;
  text-align: right;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: #303540;
}

/* ---------- 上传组件 ---------- */
.uploader {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.uploader__box {
  width: 132px;
  height: 92px;
  flex-shrink: 0;
  border: 1px dashed #cfd4dd;
  border-radius: 8px;
  background: #f7fbf9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.uploader__box:hover {
  border-color: var(--primary);
}

.uploader__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.uploader__plus {
  font-size: 13px;
  color: #98a0ad;
}

.uploader__side {
  font-size: 12px;
  color: #8a8f99;
}

.uploader__ops {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.uploader-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.uploader-list__item {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.uploader-list__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.uploader-list__del {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.uploader-list__add {
  width: 88px;
  height: 88px;
  border: 1px dashed #cfd4dd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #98a0ad;
  cursor: pointer;
  background: #f7fbf9;
}

.uploader-list__add:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------------- 弹窗标题与开关组补充 */
.dialog__title {
  font-size: 15px;
  font-weight: 600;
}

.switch + .switch {
  margin-left: 18px;
}

.card__title .tag {
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------------- 日志详情里的 JSON 代码块 */
.code-box {
  margin: 0;
  padding: 10px 12px;
  max-height: 240px;
  overflow: auto;
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}
