/* ============================================================
   成都农交所 · 后台管理端样式表
   风格：庄重政务 · 深翡翠绿主调 · 香槟金点缀
   ============================================================ */

:root {
  --green-900: #0D3A2B; --green-800: #145439; --green-700: #1B6B42;
  --green-600: #248252; --green-500: #2E9A60; --green-300: #8FBE9F;
  --green-100: #E4F1E9; --green-50: #F1F8F4;
  --gold: #B68A3C; --gold-soft: #D9BE82;
  --red: #B23A2E; --blue: #2E6FB0;
  --white: #FFFFFF; --cream: #FCFBF8;
  --gray-50: #F6F7F4; --gray-100: #EDEFEA; --gray-200: #DEE1DA;
  --gray-300: #C6CAC1; --gray-400: #90948A; --gray-500: #6C7066;
  --gray-600: #4E5248; --gray-700: #343732; --gray-800: #22251E; --gray-900: #14160F;
  --sidebar-w: 250px; --sidebar-collapsed: 68px;
  --sh-sm: 0 1px 3px rgba(26,26,22,.08);
  --sh-md: 0 6px 18px rgba(26,26,22,.10);
  --r-md: 8px; --r-lg: 12px; --r-xl: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
  font-family: "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--gray-700); background: var(--cream); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---------- 登录页 ---------- */
.admin-login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(27,107,66,.08) 0, transparent 42%),
    radial-gradient(circle at 85% 80%, rgba(182,138,60,.08) 0, transparent 42%),
    var(--cream);
}
.admin-login-card {
  width: 100%; max-width: 420px; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--r-xl);
  box-shadow: var(--sh-md); padding: 44px 36px 38px; overflow: hidden; position: relative;
}
.admin-login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--green-700), var(--gold), var(--green-700));
}
.admin-login-card .brand {
  display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 28px;
}
.admin-login-card .brand .logo-mark {
  width: 96px; height: auto; display: block; border-radius: 0;
  background: transparent; box-shadow: none;
}
.admin-login-card .brand h1 { font-size: 20px; color: var(--gray-900); letter-spacing: 1px; }
.admin-login-card .brand span { display: block; font-size: 12px; color: var(--gray-500); font-weight: 400; }
.admin-login-card h2 { text-align: center; font-size: 22px; color: var(--gray-900); margin-bottom: 8px; }
.admin-login-card .sub { text-align: center; color: var(--gray-400); font-size: 13px; margin-bottom: 28px; }
.admin-login-card .field { margin-bottom: 18px; }
.admin-login-card label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.admin-login-card input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--gray-200);
  border-radius: var(--r-md); outline: none; font-size: 14px; transition: .2s;
}
.admin-login-card input:focus { border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(46,154,96,.12); }
.admin-login-card .btn {
  width: 100%; padding: 12px; border-radius: var(--r-md); background: var(--green-700);
  color: #fff; font-weight: 600; font-size: 15px; margin-top: 8px; transition: .2s;
}
.admin-login-card .btn:hover { background: var(--green-800); }
.admin-login-card .hint { margin-top: 14px; padding: 10px; border-radius: var(--r-md); font-size: 12.5px; display: none; }
.admin-login-card .hint.err { display: block; background: rgba(178,58,46,.08); color: var(--red); border: 1px solid rgba(178,58,46,.15); }
.admin-login-card .tip { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--gray-200); font-size: 12px; color: var(--gray-400); text-align: center; }

/* ---------- 后台布局 ---------- */
.admin-app { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: var(--sidebar-w); background: var(--green-900); color: #fff;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 100;
  transition: width .25s ease;
}
.admin-sidebar .sb-head {
  height: 68px; display: flex; align-items: center; gap: 12px; padding: 0 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-sidebar .sb-head .logo-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: #fff; flex-shrink: 0; overflow: hidden;
  display: grid; place-items: center;
}
.admin-sidebar .sb-head .logo-mark img { width: 32px; height: 32px; object-fit: contain; }
.admin-sidebar .sb-head h2 { font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: .5px; }
.admin-sidebar .sb-head h2 span { display: block; font-size: 10.5px; color: var(--gold-soft); font-weight: 400; letter-spacing: 0; }
.admin-sidebar nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.admin-sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: var(--r-md); color: rgba(255,255,255,.78); font-size: 14px;
  margin-bottom: 4px; transition: .15s;
}
.admin-sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-sidebar nav a.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.admin-sidebar nav a .ico { width: 22px; text-align: center; font-size: 17px; }
.admin-sidebar nav .group { margin-bottom: 16px; }
.admin-sidebar nav .group-title {
  font-size: 11px; color: rgba(255,255,255,.4); text-transform: uppercase;
  letter-spacing: 1px; padding: 8px 14px;
}
.admin-sidebar .sb-foot {
  padding: 14px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px; color: rgba(255,255,255,.5);
}
.admin-sidebar .sb-foot .user { display: flex; align-items: center; gap: 10px; color: #fff; margin-bottom: 8px; }
.admin-sidebar .sb-foot .user .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--gold);
  display: grid; place-items: center; font-weight: 700; color: var(--green-900); font-size: 12px;
}

/* min-width:0 —— 允许主区在窄屏下收缩到内容最小宽度以下，避免整页被撑出横向滚动条 */
.admin-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.admin-content { min-width: 0; }
.admin-header {
  height: 64px; background: var(--white); border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; z-index: 90;
}
.admin-header .breadcrumb { font-size: 13px; color: var(--gray-400); }
.admin-header .breadcrumb b { color: var(--gray-800); font-weight: 600; }
.admin-header .actions { display: flex; align-items: center; gap: 12px; }
.admin-header .actions .btn-sm {
  padding: 7px 16px; border-radius: var(--r-md); font-size: 13px; font-weight: 600;
  background: var(--green-700); color: #fff; transition: .2s;
}
.admin-header .actions .btn-sm:hover { background: var(--green-800); }
.admin-content { flex: 1; padding: 26px; }

/* ---------- 仪表盘 ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 20px; margin-bottom: 24px; }
.kpi-box:nth-child(5)::before { background: var(--red); }
.kpi-box:nth-child(6)::before { background: var(--gray-300); }
.kpi-box {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--sh-sm); position: relative; overflow: hidden;
}
.kpi-box::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--green-700); }
.kpi-box:nth-child(2)::before { background: var(--gold); }
.kpi-box:nth-child(3)::before { background: var(--blue); }
.kpi-box:nth-child(4)::before { background: var(--green-300); }
.kpi-box .label { font-size: 13px; color: var(--gray-500); }
.kpi-box .value { font-size: 28px; font-weight: 800; color: var(--gray-900); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-box .delta { font-size: 12px; font-weight: 700; margin-top: 6px; }
.kpi-box .delta.up { color: var(--red); }
.kpi-box .delta.down { color: var(--green-600); }

.panel-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r-lg); box-shadow: var(--sh-sm); margin-bottom: 24px; }
.panel-card .pc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--gray-100);
}
.panel-card .pc-head h3 { font-size: 16px; color: var(--gray-900); font-weight: 700; }
.panel-card .pc-head .hint { font-size: 12px; color: var(--gray-400); }
.panel-card .pc-body { padding: 22px; }

/* ---------- 板块徽标（产权 / 粮油 / 招采） ---------- */
.badge.board-产权 { background: var(--green-100); color: var(--green-800); }
.badge.board-粮油 { background: rgba(182,138,60,.14); color: #8A6620; }
.badge.board-招采 { background: rgba(46,111,176,.12); color: var(--blue); }

/* ---------- 核心业务板块管理卡片 ---------- */
.biz-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.biz-admin-card {
  border: 1px solid var(--gray-200); border-radius: var(--r-lg); background: var(--green-50);
  padding: 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden;
  min-width: 0;
}
.biz-admin-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--green-700), var(--gold));
}
.biz-admin-card .bac-head { display: flex; align-items: center; justify-content: space-between; }
.biz-admin-card .bac-head .tag {
  font-size: 11px; font-weight: 700; color: var(--green-800);
  background: var(--white); border: 1px solid var(--green-300); border-radius: 999px; padding: 2px 10px;
}
.biz-admin-card .bac-head .ext {
  font-size: 11px; color: var(--gray-500); background: var(--white);
  border: 1px solid var(--gray-200); border-radius: 4px; padding: 2px 8px;
}
.biz-admin-card .bac-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.biz-admin-card .bac-desc { font-size: 13px; line-height: 1.75; color: var(--gray-600); flex: 1; }
.biz-admin-card .bac-href {
  font-size: 12px; color: var(--gray-400); background: var(--white); border-radius: 6px;
  padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0; max-width: 100%;
}
.biz-admin-card .edit {
  align-self: flex-start; font-size: 12px; padding: 6px 14px; border-radius: 6px;
  font-weight: 600; background: var(--green-100); color: var(--green-800); transition: .15s;
}
.biz-admin-card .edit:hover { background: var(--green-300); }

/* ---------- 表格 ---------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--gray-100); }
.admin-table thead th { background: var(--green-50); color: var(--green-900); font-weight: 700; font-size: 13px; white-space: nowrap; }
.admin-table tbody tr:hover { background: var(--gray-50); }
.admin-table .title-cell { max-width: 320px; }
.admin-table .title-cell a { color: var(--gray-800); font-weight: 600; }
.admin-table .title-cell a:hover { color: var(--green-700); }
.admin-table .meta { font-size: 12px; color: var(--gray-400); margin-top: 3px; }
.admin-table .actions { display: flex; gap: 8px; }
.admin-table .actions button {
  font-size: 12px; padding: 5px 11px; border-radius: 5px; font-weight: 600; transition: .15s;
}
.admin-table .actions .edit { background: var(--green-100); color: var(--green-800); }
.admin-table .actions .edit:hover { background: var(--green-300); }
.admin-table .actions .del { background: rgba(178,58,46,.1); color: var(--red); }
.admin-table .actions .del:hover { background: rgba(178,58,46,.2); }
.admin-table .actions .view { background: var(--gray-100); color: var(--gray-600); }
.admin-table .actions .view:hover { background: var(--gray-200); }
.admin-table .badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.admin-table .badge.top { background: rgba(178,58,46,.12); color: var(--red); }
.admin-table .badge.pub { background: var(--green-100); color: var(--green-800); }
.admin-table .badge.draft { background: var(--gray-100); color: var(--gray-500); }
.admin-table .chbox { width: 18px; height: 18px; accent-color: var(--green-700); }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { position: relative; }
.toolbar .search input {
  width: 260px; padding: 9px 14px 9px 36px; border: 1px solid var(--gray-200); border-radius: var(--r-md); outline: none; font-size: 14px;
}
.toolbar .search::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5; }
.toolbar .search input:focus { border-color: var(--green-500); }
.toolbar .filters { display: flex; gap: 10px; }
.toolbar .filters select, .toolbar .filters button {
  padding: 8px 14px; border: 1px solid var(--gray-200); border-radius: var(--r-md); font-size: 13px; background: var(--white); color: var(--gray-600);
}
.toolbar .filters button.primary { background: var(--green-700); color: #fff; border-color: var(--green-700); font-weight: 600; }

/* ---------- 分页 ---------- */
.admin-pagination { display: flex; justify-content: flex-end; gap: 6px; margin-top: 18px; }
.admin-pagination button {
  min-width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--gray-200);
  background: var(--white); color: var(--gray-600); font-size: 13px;
}
.admin-pagination button:hover { border-color: var(--green-500); color: var(--green-700); }
.admin-pagination button.active { background: var(--green-700); color: #fff; border-color: var(--green-700); }
.admin-pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 表单弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 760px; max-height: calc(100vh - 40px); overflow: hidden;
  background: var(--white); border-radius: var(--r-lg); box-shadow: var(--sh-md);
  display: flex; flex-direction: column;
}
.modal .m-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--gray-100);
}
.modal .m-head h3 { font-size: 17px; color: var(--gray-900); }
.modal .m-head .close { font-size: 22px; color: var(--gray-400); cursor: pointer; }
.modal .m-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal .m-foot { padding: 14px 22px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 10px; }
.modal .m-foot button { padding: 9px 20px; border-radius: var(--r-md); font-weight: 600; font-size: 14px; }
.modal .m-foot .cancel { background: var(--gray-100); color: var(--gray-600); }
.modal .m-foot .cancel:hover { background: var(--gray-200); }
.modal .m-foot .save { background: var(--green-700); color: #fff; }
.modal .m-foot .save:hover { background: var(--green-800); }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-bottom: 18px; }
.form-row.full { grid-template-columns: 1fr; }
.form-group { display: grid; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.form-group label .req { color: var(--red); margin-left: 3px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--gray-200); border-radius: var(--r-md); outline: none; font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--green-500); }
.form-group textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.form-group .hint { font-size: 12px; color: var(--gray-400); }
.form-group.inline { display: flex; align-items: center; gap: 10px; }
.form-group.inline input { width: auto; }

/* ---------- 富文本工具栏 ---------- */
.rich-editor { border: 1.5px solid var(--gray-200); border-radius: var(--r-md); overflow: hidden; }
.rich-editor .re-toolbar {
  display: flex; gap: 6px; padding: 8px; border-bottom: 1.5px solid var(--gray-200); background: var(--gray-50);
  flex-wrap: wrap;
}
.rich-editor .re-toolbar button {
  width: 32px; height: 32px; border-radius: 6px; background: var(--white); border: 1px solid var(--gray-200);
  color: var(--gray-600); font-size: 13px; font-weight: 700;
}
.rich-editor .re-toolbar button:hover { background: var(--green-50); border-color: var(--green-300); }
.rich-editor .re-body { min-height: 220px; padding: 12px; outline: none; font-size: 14px; line-height: 1.8; }
.rich-editor .re-body p { margin-bottom: 10px; }
.rich-editor .re-body ul { padding-left: 20px; margin-bottom: 10px; }
.rich-editor .re-body li { margin-bottom: 6px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 24px; bottom: 24px; z-index: 900; display: grid; gap: 10px; }
.toast {
  min-width: 220px; padding: 12px 18px; border-radius: var(--r-md);
  background: var(--gray-800); color: #fff; font-size: 13px; box-shadow: var(--sh-md);
  display: flex; align-items: center; gap: 9px; animation: toastIn .25s ease;
}
.toast.ok { background: var(--green-700); }
.toast.err { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- 空状态 ---------- */
/* 辅助说明文字（灰色小字） */
.muted { color: var(--gray-400); font-size: 12.5px; font-weight: 400; line-height: 1.5; }
/* 业务子页「服务内容卡片」里的说明框，不需要 120px 那么高 */
.feat-row .form-group textarea { min-height: 68px; }
.feat-row .form-group label { font-size: 12.5px; }
.feat-row button { font-size: 12.5px; padding: 5px 10px; border: 1px solid var(--gray-200); border-radius: 6px; color: var(--gray-600); background: var(--white); }
.feat-row button:hover { border-color: var(--green-500); color: var(--green-700); }
.feat-row .del:hover { border-color: var(--red); color: var(--red); }
/* 列表里标出「未配置网址」的项 */
.tag-warn { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  font-size: 11.5px; font-weight: 600; color: var(--gold); background: rgba(182,138,60,.12); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--gray-400); }
.empty-state .es-ico { font-size: 42px; opacity: .5; }
.empty-state p { margin-top: 12px; font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .admin-sidebar { width: var(--sidebar-collapsed); }
  .admin-sidebar .sb-head h2, .admin-sidebar nav a span, .admin-sidebar .group-title, .admin-sidebar .sb-foot { display: none; }
  .admin-sidebar nav a { justify-content: center; padding: 14px; }
  .admin-main { margin-left: var(--sidebar-collapsed); }
  .kpi-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 768px) {
  .admin-header { padding: 0 16px; }
  .admin-content { padding: 16px; }
  .kpi-row { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search input { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .admin-table th, .admin-table td { padding: 11px 12px; }
  .admin-table .title-cell { max-width: 160px; }
  /* 窄屏下表格横向滚动，避免整页被撑宽 */
  .panel-card .pc-body { padding: 14px; overflow-x: auto; }
  .biz-admin-grid { grid-template-columns: 1fr; }
  .biz-admin-card .bac-desc { font-size: 12.5px; }
}
