/* ============================================================
   苏小寻 · 管理后台原型
   配色与组件风格取自 RuoYi-Vue3 真实源码：
     src/settings.js（theme-dark / navType 1 / tagsView card）
     src/assets/styles/variables.module.scss
   业务数据结构沿用若依 views/system/role/index.vue
   ============================================================ */

:root {
  /* 侧边栏（theme-dark，按康康要求整体提亮一档） */
  --sidebar-bg: #232b3d;
  --sidebar-sub-bg: #2a3346;
  --sidebar-hover: #37425a;
  --menu-text: rgba(255, 255, 255, 0.85);
  --menu-active: #4fa3ff;

  /* 顶栏 */
  --navbar-bg: #ffffff;
  --navbar-text: #303133;
  --navbar-icon: #5a5e66;

  /* 内容区 */
  --page-bg: #f0f2f5;
  --card-bg: #ffffff;
  --border: #ebeef5;
  --border-soft: #f2f3f5;

  /* 文字 */
  --text: #303133;
  --text-2: #606266;
  --text-3: #909399;

  /* Element Plus 主色与语义色 */
  --primary: #409eff;
  --success: #67c23a;
  --warning: #e6a23c;
  --danger: #f56c6c;
  --info: #909399;

  /* plain 幽灵按钮 */
  --plain-primary-bg: #ecf5ff;   --plain-primary-bd: #b3d8ff;
  --plain-success-bg: #f0f9eb;   --plain-success-bd: #c2e7b0;
  --plain-danger-bg: #fef0f0;    --plain-danger-bd: #fbc4c4;
  --plain-warning-bg: #fdf6ec;   --plain-warning-bd: #f5dab1;

  /* el-tag（light 风格） */
  --tag-primary-bg: #ecf5ff;  --tag-primary-bd: #d9ecff;
  --tag-success-bg: #f0f9eb;  --tag-success-bd: #e1f3d8;
  --tag-warning-bg: #fdf6ec;  --tag-warning-bd: #faecd8;
  --tag-info-bg: #f4f4f5;     --tag-info-bd: #e9e9eb;

  --radius: 4px;
}

* { box-sizing: border-box; }

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

body {
  background: var(--page-bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.serif { font-family: "Songti SC", "STSong", "SimSun", serif; }

/* ============================ 顶栏 ============================ */

.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 50px;
  background: var(--navbar-bg);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  z-index: 30;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.navbar__toggle {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--navbar-icon); font-size: 16px; cursor: pointer;
}

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-3);
}
.breadcrumb__sep { color: #c0c4cc; }
.breadcrumb__cur { color: var(--text); }

.navbar__spacer { flex: 1; }

.navbar__icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  color: var(--navbar-icon); font-size: 14px; cursor: pointer;
  border-radius: 4px;
}
.navbar__icon:hover { background: #f2f3f5; }

.navbar__user {
  display: flex; align-items: center; gap: 8px;
  color: var(--navbar-text); font-size: 13px; cursor: pointer;
}

.navbar__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* ============================ 侧边栏 ============================ */

.sidebar {
  position: fixed;
  top: 50px; bottom: 0; left: 0;
  width: 200px;
  background: var(--sidebar-bg);
  overflow-y: auto;
  z-index: 20;
  transition: width 0.2s;
}

.sidebar__logo {
  height: 50px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: #fff; font-size: 14px; font-weight: 700; letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar__seal {
  width: 24px; height: 24px; border-radius: 4px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}

.nav { padding: 8px 0 24px; }

.nav__item {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 16px;
  color: var(--menu-text);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.nav__item:hover,
.nav__sub:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav__item.is-active {
  background: rgba(79, 163, 255, 0.28);
  color: var(--menu-active);
  box-shadow: inset 3px 0 0 var(--menu-active);
}

/* 二级菜单：不给独立背景块（会和主底色打架、且降低白字对比度）
   层级靠缩进 + 字号区分，整体保持明亮 */
.nav__sub {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 16px 0 36px;
  font-size: 13px;
  color: var(--menu-text);
}


.nav__sub.is-active {
  background: rgba(79, 163, 255, 0.28);
  color: var(--menu-active);
  box-shadow: inset 3px 0 0 var(--menu-active);
}

.nav__arrow {
  margin-left: auto;
  font-size: 10px;
  color: #6b7280;
}

.nav__label { white-space: nowrap; overflow: hidden; }

/* 折叠态 */
.sidebar.is-collapsed { width: 64px; }
.sidebar.is-collapsed .nav__sub,
.sidebar.is-collapsed .nav__label,
.sidebar.is-collapsed .nav__arrow { display: none; }
.sidebar.is-collapsed .nav__item { justify-content: center; padding: 0; }
.main.is-collapsed { margin-left: 64px; }

/* ============================ 主区 ============================ */

.main {
  margin: 50px 0 0 200px;
  min-height: calc(100vh - 50px);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s;
}

.tagsview {
  height: 34px;
  background: #fff;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 5px;
  padding: 0 10px;
  position: sticky; top: 50px; z-index: 10;
}

.tagsview__tag {
  display: flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 2px;
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid #d8dce0;
  white-space: nowrap;
  cursor: pointer;
}
.tagsview__tag:hover { color: var(--primary); }
.tagsview__tag.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.tagsview__close { font-size: 12px; opacity: 0.8; }
.tagsview__tag.is-active .tagsview__close { color: #fff; }

.content { flex: 1; padding: 12px; }

/* ============================ 卡片 ============================ */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.card + .card { margin-top: 12px; }

.card__body { padding: 16px; }

/* ============================ 按钮（plain 幽灵风格） ============================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 32px; padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid #dcdfe6;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }

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

/* plain 幽灵按钮 */
.btn--plain-primary {
  background: var(--plain-primary-bg); border-color: var(--plain-primary-bd); color: var(--primary);
}
.btn--plain-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

.btn--plain-success {
  background: var(--plain-success-bg); border-color: var(--plain-success-bd); color: var(--success);
}
.btn--plain-success:hover { background: var(--success); border-color: var(--success); color: #fff; }

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

.btn--plain-warning {
  background: var(--plain-warning-bg); border-color: var(--plain-warning-bd); color: var(--warning);
}
.btn--plain-warning:hover { background: var(--warning); border-color: var(--warning); color: #fff; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--plain-primary-bg); color: var(--primary); }
.btn--primary:disabled:hover { background: var(--primary); color: #fff; }

.circle-btn {
  width: 32px; height: 32px; padding: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #dcdfe6; background: #fff; color: var(--text-2);
  cursor: pointer; font-size: 14px;
}
.circle-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ============================ 表单 ============================ */

.form-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
}

.field {
  display: flex; align-items: center; gap: 8px;
}
.field__label {
  width: 68px; flex-shrink: 0;
  font-size: 13px; color: var(--text-2);
}

.input, .select, .textarea {
  height: 32px; padding: 0 10px;
  border: 1px solid #dcdfe6; border-radius: var(--radius);
  background: #fff; color: var(--text); font-size: 13px;
  font-family: inherit;
  width: 200px;
}
.textarea { height: auto; min-height: 70px; padding: 7px 10px; width: 100%; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); }
.input.is-error, .textarea.is-error { border-color: var(--danger); }

.form-field { margin-bottom: 11px; }
.form-field__label {
  display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px;
}
.form-field__req { color: var(--danger); margin-left: 2px; }
.form-field__error { font-size: 11px; color: var(--danger); margin-top: 4px; min-height: 14px; }
.form-field__hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ---------------- 图片上传 ---------------- */

.uploader {
  width: 104px; height: 104px;
  border: 1px dashed #dcdfe6;
  border-radius: 6px;
  background: #fafafa;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s;
}
.uploader:hover { border-color: var(--primary); }

.uploader__plus { font-size: 26px; line-height: 1; color: #8c939d; }
.uploader__tip { font-size: 11px; color: #8c939d; }

.uploader__img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #fff;
}

.uploader__mask {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  opacity: 0; transition: opacity 0.15s;
}
.uploader:hover .uploader__mask { opacity: 1; }
.uploader__act { cursor: pointer; }
.uploader__act:hover { text-decoration: underline; }

/* 行内缩略图（列表用） */
.thumb {
  width: 34px; height: 34px;
  border-radius: 4px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: #fafafa;
  display: block;
}
.thumb--empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-3);
}

/* ============================ 表格 ============================ */

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

.table th {
  text-align: left;
  font-weight: 600;
  color: #515a6e;
  font-size: 12px;
  padding: 10px 12px;
  background: #f8f8f9;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

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

.table__empty { padding: 40px; text-align: center; color: var(--text-3); font-size: 13px; }

.checkbox {
  width: 14px; height: 14px; border-radius: 2px;
  border: 1px solid #dcdfe6; background: #fff; flex-shrink: 0;
}

/* el-tag（light 风格） */
.tag {
  display: inline-block;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 22px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tag--primary { background: var(--tag-primary-bg); color: var(--primary); border-color: var(--tag-primary-bd); }
.tag--success { background: var(--tag-success-bg); color: var(--success); border-color: var(--tag-success-bd); }
.tag--warning { background: var(--tag-warning-bg); color: var(--warning); border-color: var(--tag-warning-bd); }
.tag--info    { background: var(--tag-info-bg);    color: var(--info);    border-color: var(--tag-info-bd); }

/* 操作列图标按钮 */
.icon-btn {
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
}
.icon-btn:hover { opacity: 0.7; }

/* ============================ 工具栏 ============================ */

.toolbar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.toolbar__spacer { flex: 1; }

/* ============================ 分页 ============================ */

.pager {
  display: flex; align-items: center; gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px; color: var(--text-2);
}
.pager__spacer { flex: 1; }

.page-btn {
  min-width: 32px; height: 32px; padding: 0 6px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.page-btn:hover { color: var(--primary); }
.page-btn.is-active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.page-btn:disabled { color: #c0c4cc; cursor: not-allowed; }

/* ============================ 统计卡 ============================ */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.stat {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.stat__label { font-size: 13px; color: var(--text-3); }
.stat__value { font-size: 26px; font-weight: 700; margin-top: 2px; color: var(--text); }
.stat__sub { font-size: 11px; margin-top: 2px; color: var(--text-3); }
.stat__sub.is-up { color: var(--success); }
.stat__sub.is-warn { color: var(--warning); }

.grid-2 { display: grid; grid-template-columns: 1fr 400px; gap: 12px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ============================ 时间轴 ============================ */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item {
  position: relative; padding: 0 0 16px 18px;
  border-left: 1px solid var(--border);
}
.timeline__item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline__item::before {
  content: ""; position: absolute; left: -4px; top: 6px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
}
.timeline__time { font-size: 11px; color: var(--text-3); }
.timeline__text { font-size: 13px; }

/* ============================ 抽屉 / 弹窗 ============================ */

.drawer-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 50; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 560px; max-width: 92vw;
  background: #fff;
  z-index: 51;
  display: flex; flex-direction: column;
  animation: slideIn 0.2s ease-out;
}
.drawer__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.drawer__title { font-size: 15px; font-weight: 600; }
.drawer__body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0.5; } to { transform: none; opacity: 1; } }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
  z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
/* 高度自适应：最高不超过视口，内容超出时只滚动中段，
   头尾固定 —— 保证「取消 / 确定」永远可见 */
.modal {
  width: 500px;
  max-width: 92vw;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  animation: popIn 0.18s ease-out;
}
.modal__head { padding: 16px 20px 8px; flex-shrink: 0; }
.modal__title { font-size: 15px; font-weight: 600; }
.modal__body { padding: 4px 20px 8px; flex: 1; overflow-y: auto; min-height: 0; }
.modal__foot {
  padding: 12px 20px 16px;
  display: flex; gap: 8px; justify-content: flex-end;
  flex-shrink: 0;
  border-top: 1px solid var(--border-soft);
  background: #fff;
}
@keyframes popIn { from { transform: scale(0.97); opacity: 0.5; } to { transform: none; opacity: 1; } }

/* ============================ 提示 ============================ */

.toast-wrap {
  position: fixed; top: 62px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.toast {
  padding: 7px 14px; border-radius: var(--radius);
  background: rgba(48, 49, 51, 0.92); color: #fff; font-size: 12px;
  animation: popIn 0.18s ease-out;
}
.toast--ok { background: rgba(103, 194, 58, 0.94); }
.toast--err { background: rgba(245, 108, 108, 0.94); }

/* 键值对 */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; font-size: 13px; }
.kv__k { color: var(--text-3); }

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

.section-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  padding-bottom: 8px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

/* ============================ 登录页 ============================ */

.login-page {
  position: fixed; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1f2e 0%, #33405c 62%, #3d5273 100%);
  z-index: 100;
}

.login-box {
  width: 380px;
  max-width: 92vw;
  background: #fff;
  border-radius: 6px;
  padding: 30px 32px 26px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.26);
  animation: popIn 0.22s ease-out;
}

.login-box__title {
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  color: #303133;
  letter-spacing: 1px;
  margin-bottom: 22px;
}

.login-field {
  position: relative;
  margin-bottom: 14px;
}

.login-field__icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: #a8abb2;
  font-size: 14px;
}

.login-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  color: #303133;
  background: #fff;
  transition: border-color 0.15s;
}
.login-input:focus { outline: none; border-color: var(--primary); }

.login-field--code .login-input { padding-right: 98px; }

.login-code {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--primary);
  background: #ecf5ff;
  border: 1px solid #d9ecff;
  border-radius: 3px;
  padding: 3px 8px;
  user-select: none;
  letter-spacing: 0.5px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 16px;
  cursor: pointer;
}

.login-btn {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 4px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.login-btn:hover { background: #66b1ff; }

.login-tip {
  margin-top: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
}

.login-foot {
  position: absolute;
  bottom: 22px; left: 0; right: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
}

/* ============================ 系统版补充 ============================ */

/* 勾选框选中态 */
.checkbox { cursor: pointer; position: relative; }
.checkbox.is-on { border-color: var(--primary); background: var(--primary); }
.checkbox.is-on::after {
  content: '';
  position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid #fff; border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* 登录页图形验证码 */
.login-code { padding: 0; overflow: hidden; cursor: pointer; line-height: 0; }
.login-code img { height: 34px; display: block; border-radius: 2px; }

/* 搜索区日期控件 */
.input--date { width: 150px; }

/* 表格数据加载中 */
.table__loading { padding: 40px; text-align: center; color: var(--text-3); font-size: 13px; }

/* 快递弹窗公司选择 */
.express-row { display: flex; gap: 10px; margin-bottom: 4px; align-items: flex-start; }
.express-row .select { flex: 0 0 150px; }

/* 确认弹窗（仿若依 MessageBox） */
.btn--danger { background: var(--danger, #f56c6c); border-color: var(--danger, #f56c6c); color: #fff; }
.confirm-msg { font-size: 14px; color: var(--text-1); line-height: 1.7; padding: 6px 2px 2px; }

/* 系统管理：角色勾选树 / 角色多选 */
.mtree, .mtree ul { list-style: none; margin: 0; padding-left: 18px; }
.mtree { max-height: 260px; overflow: auto; border: 1px solid var(--border, #ebeef5); border-radius: 4px; padding: 8px; }
.mtree__item { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; padding: 2px 0; }
.mtree__perm { font-size: 11px; color: #909399; background: #f4f4f5; padding: 0 5px; border-radius: 3px; }
.sysrole-list { display: flex; flex-wrap: wrap; gap: 6px 18px; border: 1px solid var(--border, #ebeef5); border-radius: 4px; padding: 10px; }
.sysrole-cb { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.sysrole-key { font-size: 11px; color: #909399; }
