/* 维普特汽车服务 · 管理后台样式 */

:root {
  --ink: #12161a;
  --graphite: #1c2229;
  --graphite-2: #2a323b;
  --steel: #5d6674;
  --line: #dfe4e9;
  --paper: #f5f6f8;
  --white: #ffffff;
  --orange: #ff6a13;
  --orange-dark: #e2550a;
  --orange-soft: #fff1e7;
  --teal: #0d8a80;
  --teal-soft: #e6f4f2;
  --red: #c0392b;
  --green: #1e7a54;
  --radius: 8px;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }

/* 登录 */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--graphite);
  padding: 24px;
}

.login-card {
  width: min(100%, 400px);
  background: var(--white);
  border-radius: var(--radius);
  padding: 34px 32px 28px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  border-top: 4px solid var(--orange);
}

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

.login-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--orange);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
}

.login-brand strong { display: block; font-size: 17px; }
.login-brand small { color: var(--steel); font-size: 12.5px; }

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  margin-bottom: 14px;
}

.login-card input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 106, 19, 0.15);
}

.login-card button {
  width: 100%;
  padding: 13px;
  border: 0;
  border-radius: var(--radius);
  background: var(--orange);
  color: var(--white);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

.login-card button:hover { background: var(--orange-dark); }

.login-error { color: var(--red); font-size: 13px; margin: 0 0 10px; min-height: 18px; }
.login-note { font-size: 12.5px; color: var(--steel); margin: 14px 0 0; }
.login-note code { background: var(--paper); padding: 1px 5px; border-radius: 4px; }

/* 布局 */
.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink);
  color: #c3cbd4;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 6px 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 14px;
}

.sidebar-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--orange);
  color: var(--white);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.sidebar-brand strong { color: var(--white); font-size: 14.5px; display: block; }
.sidebar-brand small { font-size: 11px; letter-spacing: 0.08em; }

.sidebar-nav { display: grid; gap: 2px; }

.nav-item, .sidebar-foot a, .sidebar-foot button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover, .sidebar-foot a:hover, .sidebar-foot button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.nav-item.is-active {
  background: var(--orange);
  color: var(--white);
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 12px;
  display: grid;
  gap: 2px;
  font-size: 13.5px;
}

.workspace { min-width: 0; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 16px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 { font-size: 20px; }
.topbar p { margin: 2px 0 0; color: var(--steel); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.status-dot {
  font-size: 12.5px;
  color: var(--green);
  background: var(--teal-soft);
  padding: 5px 11px;
  border-radius: 999px;
  font-weight: 600;
}

.status-dot.is-busy { color: var(--orange-dark); background: var(--orange-soft); }
.status-dot.is-error { color: var(--red); background: #fdecea; }

.views { padding: 24px 26px 60px; }
.view { display: none; }
.view.is-active { display: block; }

/* 按钮 */
.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: var(--orange-dark); }
.btn-ghost { background: var(--white); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { color: var(--red); }

.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* 面板与表格 */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.panel-head h2 { font-size: 17px; }
.panel-desc { margin: 4px 0 0; color: var(--steel); font-size: 13px; }
.panel-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.table-scroll { overflow-x: auto; margin: 0 -22px -22px; }

.data-table { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 13.5px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table thead th { background: #fafbfc; color: var(--steel); font-size: 12.5px; white-space: nowrap; }
.data-table tbody tr:hover { background: #fafbfc; }
.col-actions { width: 190px; }
.row-actions { display: flex; gap: 6px; }
.row-actions button, .row-actions a {
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}
.row-actions button:hover, .row-actions a:hover { border-color: var(--ink); }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.tag-published { background: var(--teal-soft); color: var(--green); }
.tag-draft { background: #eef1f4; color: var(--steel); }
.tag-success { background: var(--teal-soft); color: var(--green); }
.tag-failed { background: #fdecea; color: var(--red); }
.tag-running, .tag-queued { background: var(--orange-soft); color: var(--orange-dark); }

/* 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-card span { display: block; color: var(--steel); font-size: 12.5px; }
.stat-card strong { font-size: 26px; font-family: var(--mono); display: block; margin-top: 4px; }

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

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

.form-grid label, .publish-form > label {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.form-grid input, .form-grid select, .form-grid textarea,
.panel-actions input, .panel-actions select,
.publish-form input, .publish-form select,
.integration-config input,
.integration-config select {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 400;
  background: var(--white);
}

.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus,
.panel-actions input:focus, .publish-form select:focus, .integration-config input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 106, 19, 0.13);
}

.form-grid textarea { resize: vertical; }
.form-subtitle { font-size: 15px; margin: 26px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin-top: 24px; font-size: 13px; font-weight: 600; }
.checkbox-label input { width: auto; margin: 0; }

/* 网站内容 */
.content-panel { padding-bottom: 16px; }
.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.page-tab {
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--steel);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.page-tab:hover { border-color: var(--ink); color: var(--ink); }
.page-tab.is-active { background: var(--ink); border-color: var(--ink); color: var(--white); }
.page-editor-bar {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 0;
}
.page-editor-bar > span { color: var(--steel); font-size: 12.5px; }
.page-image-tools { display: flex; align-items: center; gap: 8px; }
.page-image-tools input {
  width: min(420px, 46vw);
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font: inherit;
  font-size: 12.5px;
}
.page-image-tools input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 106, 19, 0.13);
}
.page-visual-editor {
  display: block;
  width: 100%;
  height: min(72vh, 860px);
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}
.page-source-editor {
  width: 100%;
  min-height: min(72vh, 860px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
  font: 13px/1.65 var(--mono);
  color: #d8e0e8;
  background: #12161a;
  tab-size: 2;
}
.page-source-editor:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 106, 19, 0.13);
}

/* 媒体库 */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.media-item { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.media-item .media-thumb { aspect-ratio: 4 / 3; background: #eef1f4; display: grid; place-items: center; overflow: hidden; }
.media-item .media-thumb img, .media-item .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-item .media-thumb .video-badge { color: var(--white); background: rgba(0, 0, 0, 0.6); padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.media-meta { padding: 10px 12px; }
.media-meta strong { display: block; font-size: 12.5px; word-break: break-all; }
.media-meta small { color: var(--steel); font-size: 11.5px; }
.media-actions { display: flex; gap: 6px; margin-top: 8px; }
.media-actions button { flex: 1; padding: 5px; font-size: 12px; border: 1px solid var(--line); background: var(--white); border-radius: 6px; cursor: pointer; }
.media-actions button:hover { border-color: var(--ink); }

/* 案例编辑器媒体选择 */
.media-editor { margin: 22px 0; padding: 18px; border: 1px dashed var(--line); border-radius: var(--radius); background: #fafbfc; }
.media-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.media-editor-head h3 { font-size: 15px; }
.media-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.media-pick { position: relative; border: 2px solid transparent; border-radius: var(--radius); overflow: hidden; background: var(--white); cursor: pointer; }
.media-pick.is-cover { border-color: var(--orange); }
.media-pick .pick-thumb { aspect-ratio: 4 / 3; background: #eef1f4; display: grid; place-items: center; overflow: hidden; }
.media-pick img, .media-pick video { width: 100%; height: 100%; object-fit: cover; }
.media-pick .pick-label { font-size: 11.5px; padding: 6px 8px; color: var(--steel); word-break: break-all; }
.media-pick .pick-remove { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 6px; border: 0; background: rgba(0, 0, 0, 0.6); color: var(--white); cursor: pointer; font-size: 13px; }

/* 平台接口 */
.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.integration-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--white); display: flex; flex-direction: column; }
.integration-card header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.integration-card h3 { font-size: 15.5px; }
.integration-card p { color: var(--steel); font-size: 13px; margin: 8px 0 14px; }
.mode-tag { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.mode-api { background: var(--teal-soft); color: var(--green); }
.mode-export { background: var(--orange-soft); color: var(--orange-dark); }
.integration-config { display: grid; gap: 12px; margin-bottom: 14px; }
.integration-config label { font-size: 12.5px; font-weight: 700; }
.integration-foot { margin-top: auto; display: flex; gap: 8px; }
.integration-foot button { flex: 1; }

/* 发布中心 */
.publish-form { display: grid; gap: 18px; max-width: 760px; }
.publish-channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.channel-check { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--white); cursor: pointer; font-size: 13.5px; font-weight: 600; }
.channel-check input { width: auto; margin: 0; }
.channel-check small { display: block; color: var(--steel); font-weight: 400; font-size: 12px; }

/* 模态 */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(10, 13, 16, 0.6); display: flex; align-items: flex-start; justify-content: center; padding: 30px 20px; overflow-y: auto; }
.modal-card { width: min(100%, 880px); background: var(--white); border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.modal-close { border: 0; background: none; color: var(--steel); cursor: pointer; font-size: 14px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius); }

/* 上传进度与提示 */
.upload-progress { margin: 12px 0; font-size: 13px; color: var(--steel); }
.progress-bar { height: 6px; background: #eef1f4; border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress-bar span { display: block; height: 100%; background: var(--orange); width: 0; transition: width 0.2s ease; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  background: var(--ink);
  color: var(--white);
  padding: 13px 18px;
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  font-size: 13.5px;
  max-width: 360px;
}
.toast.is-error { background: var(--red); }
.toast.is-success { background: var(--green); }

.empty-state { color: var(--steel); font-size: 13.5px; padding: 26px 0; text-align: center; }

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .integration-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar-nav { grid-template-columns: repeat(2, 1fr); }
  .sidebar-foot { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .publish-channels { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .form-grid, .stat-grid, .sidebar-nav { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .views { padding: 18px 14px 50px; }
  .topbar { padding: 14px; flex-direction: column; align-items: flex-start; }
  .page-image-tools { width: 100%; align-items: stretch; flex-direction: column; }
  .page-image-tools input { width: 100%; }
  .page-visual-editor { min-height: 520px; }
}
