/* ============================================================
   DAYU 后台扩展样式（增量叠加，复用原站 --seed-* 设计体系）
   加载顺序：style.css 之后 → 本文件最后生效，不覆盖原站组件
   ============================================================ */

/* ---------- 登录遮罩 ---------- */
#loginScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(94,106,210,0.10), rgba(113,112,255,0.06)), var(--seed-bg);
  backdrop-filter: blur(4px);
}
#loginScreen.is-hidden { display: none; }

.login-card {
  width: 380px;
  max-width: calc(100vw - 40px);
  background: var(--seed-surface);
  border: 1px solid var(--seed-border);
  border-radius: var(--seed-radius-lg);
  box-shadow: 0 12px 40px var(--seed-shadow);
  padding: 32px 28px 26px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.login-brand-icon {
  width: 40px; height: 40px;
  border-radius: var(--seed-radius);
  background: var(--seed-primary-bg);
  color: var(--seed-primary);
  display: flex; align-items: center; justify-content: center;  font-size: 20px;
}
.login-brand-text { font-size: 16px; font-weight: 600; color: var(--seed-fg); }
.login-brand-sub { font-size: 12px; color: var(--seed-fg-tertiary); }

.login-field { margin-bottom: 14px; }
.login-label { display: block; font-size: 13px; color: var(--seed-fg-secondary); margin-bottom: 6px; }
.login-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--seed-fg);
  background: var(--seed-bg);
  border: 1px solid var(--seed-border);
  border-radius: var(--seed-radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-input:focus {
  border-color: var(--seed-primary);
  box-shadow: 0 0 0 3px var(--seed-primary-bg);
}
.login-error {
  color: var(--seed-danger);
  font-size: 12px;
  margin-bottom: 10px;
  min-height: 16px;
}
.login-submit {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--seed-fg-on-primary);
  background: var(--seed-primary);
  border: none;
  border-radius: var(--seed-radius-sm);
  cursor: pointer;
  transition: background .15s;
}
.login-submit:hover { background: var(--seed-primary-hover); }

/* ---------- 顶栏用户区 ---------- */
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  position: relative;
}
.topbar-user-avatar {
  width: 30px; height: 30px; border-radius: var(--seed-radius-pill);
  background: var(--seed-primary); color: var(--seed-fg-on-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.topbar-user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-user-name { font-size: 13px; font-weight: 500; color: var(--seed-fg); }
.topbar-user-role { font-size: 11px; color: var(--seed-fg-tertiary); }
.role-badge {
  font-size: 10px; padding: 1px 7px; border-radius: var(--seed-radius-pill);
  font-weight: 600;
}
.role-super_admin { background: var(--seed-primary-bg); color: var(--seed-primary); }
.role-admin { background: var(--seed-success-bg); color: var(--seed-success); }
.role-procurement { background: var(--seed-warning-bg); color: var(--seed-warning); }

.topbar-user-menu {
  position: absolute; top: 40px; right: 0;
  min-width: 160px;
  background: var(--seed-surface);
  border: 1px solid var(--seed-border);
  border-radius: var(--seed-radius);
  box-shadow: 0 8px 24px var(--seed-shadow);
  padding: 6px; z-index: 50;
}
.topbar-user-menu[hidden] { display: none; }
.topbar-user-menu button {
  width: 100%; text-align: left; padding: 8px 10px;
  font-size: 13px; font-family: inherit; color: var(--seed-fg);
  background: none; border: none; border-radius: var(--seed-radius-sm);
  cursor: pointer;
}
.topbar-user-menu button:hover { background: var(--seed-primary-bg); }

/* ---------- 通用：状态徽章（扩展原站 .status-badge） ---------- */
.proc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 2px 9px; border-radius: var(--seed-radius-pill);
  font-weight: 500;
}
.proc-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 排序表头 ---------- */
.sortable-th {
  cursor: pointer; user-select: none;
  white-space: nowrap;
}
.sortable-th:hover { color: var(--seed-primary); }
.sort-arrow {
  margin-left: 4px; font-size: 10px; color: var(--seed-fg-tertiary);
}
.sort-arrow.sort-idle { opacity: 0.3; }

/* ---------- 管理视图卡片网格 ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--seed-spacing);
  margin-top: 18px;
}
.admin-card {
  background: var(--seed-surface);
  border: 1px solid var(--seed-border);
  border-radius: var(--seed-radius-lg);
  padding: 18px;
}
.admin-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.admin-card p { font-size: 13px; color: var(--seed-fg-secondary); }

/* 表单（复用原站 form-* 观感） */
.admin-form-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-form-group { flex: 1; min-width: 200px; }
.admin-form-label { display: block; font-size: 13px; color: var(--seed-fg-secondary); margin-bottom: 6px; }
.admin-input, .admin-select {
  width: 100%; padding: 9px 11px; font-size: 14px; font-family: inherit;
  color: var(--seed-fg); background: var(--seed-bg);
  border: 1px solid var(--seed-border); border-radius: var(--seed-radius-sm);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.admin-input:focus, .admin-select:focus {
  border-color: var(--seed-primary); box-shadow: 0 0 0 3px var(--seed-primary-bg);
}
.admin-btn {
  padding: 9px 16px; font-size: 13px; font-weight: 600; font-family: inherit;
  color: var(--seed-fg-on-primary); background: var(--seed-primary);
  border: none; border-radius: var(--seed-radius-sm); cursor: pointer;
  transition: background .15s;
}
.admin-btn:hover { background: var(--seed-primary-hover); }
.admin-btn.secondary {
  background: var(--seed-bg); color: var(--seed-fg); border: 1px solid var(--seed-border);
}
.admin-btn.secondary:hover { background: var(--seed-surface-elevated); }
.admin-btn.danger { background: var(--seed-danger); }
.admin-btn.danger:hover { filter: brightness(1.05); }

/* 内联编辑单元格 */
.cell-edit {
  border: 1px solid var(--seed-border); border-radius: var(--seed-radius-sm);
  padding: 4px 8px; font-size: 13px; font-family: inherit; width: 120px;
  background: var(--seed-bg); color: var(--seed-fg);
}
.cell-edit:focus { border-color: var(--seed-primary); outline: none; }
.link-btn {
  background: none; border: none; color: var(--seed-primary);
  font-size: 13px; cursor: pointer; font-family: inherit; padding: 0 4px;
}
.link-btn:hover { text-decoration: underline; }

/* 售后处理卡片 */
.aftersales-card {
  background: var(--seed-surface); border: 1px solid var(--seed-border);
  border-radius: var(--seed-radius-lg); padding: 16px; margin-bottom: 14px;
}
.aftersales-card .as-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.aftersales-card .as-order { font-weight: 600; font-size: 14px; }
.aftersales-card .as-reason { font-size: 12px; color: var(--seed-fg-tertiary); margin-bottom: 10px; }

/* 子母单分组 */
.group-row { background: var(--seed-surface-elevated); }
.group-summary { font-weight: 600; cursor: pointer; }
.group-children td { padding-left: 36px; font-size: 13px; color: var(--seed-fg-secondary); }

/* 设置分区 */
.settings-section {
  background: var(--seed-surface); border: 1px solid var(--seed-border);
  border-radius: var(--seed-radius-lg); padding: 20px; margin-bottom: 16px;
}
.settings-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.settings-section .desc { font-size: 12px; color: var(--seed-fg-tertiary); margin-bottom: 14px; }

/* 空状态 */
.admin-empty {
  text-align: center; padding: 48px 20px; color: var(--seed-fg-tertiary); font-size: 14px;
}

/* ---------- 侧栏底部用户区（左下角） ---------- */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-top: 8px;
  border-radius: var(--seed-radius);
  cursor: pointer; position: relative;
  transition: background .15s;
}
.sidebar-user:hover { background: var(--seed-primary-bg); }
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: var(--seed-radius-pill);
  background: var(--seed-primary); color: var(--seed-fg-on-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.sidebar-user-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 500; color: var(--seed-fg); }
.sidebar-user-role { font-size: 11px; color: var(--seed-fg-tertiary); }

.sidebar-user-menu {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 6px;
  min-width: 150px;
  background: var(--seed-surface);
  border: 1px solid var(--seed-border);
  border-radius: var(--seed-radius);
  box-shadow: 0 8px 24px var(--seed-shadow);
  padding: 6px; z-index: 50;
}
.sidebar-user-menu[hidden] { display: none; }
.sidebar-user-menu button {
  width: 100%; text-align: left; padding: 8px 10px;
  font-size: 13px; font-family: inherit; color: var(--seed-fg);
  background: none; border: none; border-radius: var(--seed-radius-sm);
  cursor: pointer;
}
.sidebar-user-menu button:hover { background: var(--seed-primary-bg); }

/* 顶栏深色模式切换按钮（从侧栏移到顶栏） */
.topbar-theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--seed-radius);
  background: none; border: 1px solid var(--seed-border); cursor: pointer;
  color: var(--seed-fg-secondary); padding: 0; margin-left: 8px;
  transition: background .15s, color .15s;
}
.topbar-theme-toggle:hover { background: var(--seed-primary-bg); color: var(--seed-primary); }
.topbar-theme-toggle svg { width: 16px; height: 16px; }

/* 危险操作链接 */
.danger-link { color: var(--seed-danger) !important; }
.danger-link:hover { color: var(--seed-danger) !important; text-decoration-color: var(--seed-danger) !important; }

/* 修改历史：新旧值颜色 */
.hist-old { color: var(--seed-fg-tertiary); text-decoration: line-through; }
.hist-new { color: var(--seed-success); font-weight: 500; }

/* 权限配置弹窗中的 checkbox */
.perm-check {
  width: 16px; height: 16px; accent-color: var(--seed-primary);
  cursor: pointer;
}
.perm-check[disabled] { opacity: 0.5; cursor: not-allowed; }

/* 侧栏无权限菜单项：保留可见 + 锁图标 */
.nav-item.nav-locked { opacity: 0.55; cursor: not-allowed; }
.nav-item.nav-locked:hover { background: var(--seed-primary-bg); }
.nav-lock {
  margin-left: auto;
  font-size: 12px;
  line-height: 1;
  opacity: 0.8;
  filter: grayscale(0.2);
}

/* 采购工作台：左侧空心圆采购状态按钮 */
.proc-circle {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--seed-fg-tertiary);
  background: transparent;
  cursor: pointer; padding: 0;
  display: block; margin: 0 auto;
  transition: all .15s ease;
}
.proc-circle.proc-todo { border-color: var(--seed-fg-tertiary); }
.proc-circle.proc-done { background: var(--seed-success); border-color: var(--seed-success); }
.proc-circle.proc-nopurch { background: var(--seed-primary); border-color: var(--seed-primary); cursor: not-allowed; }
.proc-circle.proc-nopurch:hover { box-shadow: none; }
.proc-circle:hover { box-shadow: 0 0 0 3px var(--seed-primary-bg); }
.proc-order-link { cursor: pointer; font-weight: 500; }
.proc-order-link:hover { text-decoration: underline; }

/* ================================================================
 *  订单详情页 — 长条形布局 + 点击编辑
 * ================================================================ */
.od-wrap { padding-bottom: 24px; }

/* 返回按钮 */
.od-back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; font-size: 13px; border: 1px solid var(--seed-border);
  border-radius: 10px; background: var(--seed-surface);
  color: var(--seed-fg-secondary); cursor: pointer; font-family: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); transition: all .12s;
  margin-bottom: 14px;
}
.od-back-btn:hover { border-color: var(--seed-primary); color: var(--seed-primary); }

/* 完单日期（融入 hero-info 内，订单ID下方紧凑显示） */
.oq-hero-date {
  font-size: 12px;
  color: var(--seed-fg-tertiary);
  margin-top: 2px;
}
.oq-hero-date::before {
  content: '📅 ';
}

/* ===== 长条形区块（每区一个全宽横条）===== */
.od-sections { display: flex; flex-direction: column; gap: 14px; }

.od-sec {
  background: var(--seed-surface);
  border-radius: 10px;
  border: 1px solid var(--seed-border);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}

/* 区块标题栏：左侧色条 + 标题 */
.od-sec-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--od-accent, var(--seed-fg));
  background: linear-gradient(90deg, color-mix(in srgb, var(--od-accent) 8%, transparent), transparent 60%);
  border-bottom: 1px solid var(--seed-border-alpha, rgba(128,128,128,.06));
}
.od-sec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--od-accent, var(--seed-primary));
  flex-shrink: 0;
}

/* 区块内容：字段网格 */
.od-sec-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
  padding: 4px 0;
}

/* 单行字段 */
.od-row {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(128,128,128,.04);
  cursor: default;
  transition: background .1s;
}
.od-row:last-child { border-bottom: none; }
.od-row:hover { background: rgba(128,128,128,.03); }

.od-label {
  width: 90px; flex-shrink: 0;
  color: var(--seed-fg-tertiary);
  font-size: 12px;
}
.od-val {
  color: var(--seed-fg);
  word-break: break-all;
  line-height: 1.4;
}
.od-val.od-price { font-weight: 600; }

/* 商品链接 */
.od-link {
  color: var(--seed-primary);
  text-decoration: none;
  font-weight: 500;
}
.od-link:hover { text-decoration: underline; }

/* 可编辑行：铅笔图标 */
.od-row.od-editable { cursor: pointer; }
.od-row.od-editable:hover { background: var(--seed-primary-bg); }
.od-row.od-editable:hover .od-val { color: var(--seed-primary); }
.od-edit-icon {
  opacity: 0;
  color: var(--seed-primary);
  flex-shrink: 0;
  transition: opacity .15s;
  margin-left: auto;
}
.od-row.od-editable:hover .od-edit-icon { opacity: 1; }

.od-edit-hint {
  margin-top: 14px; text-align: center;
  font-size: 12px; color: var(--seed-fg-tertiary);
}

/* ===== 采购编辑弹窗（双列网格）===== */
.proc-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.proc-edit-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.proc-edit-field.proc-edit-full {
  grid-column: 1 / -1;
}
.proc-edit-label {
  font-size: 12px;
  color: var(--seed-fg-secondary);
  font-weight: 500;
}
.proc-edit-grid .admin-input,
.proc-edit-grid .admin-select {
  height: 34px;
  font-size: 13px;
}
.proc-edit-grid .admin-textarea {
  resize: vertical;
  min-height: 48px;
  font-size: 13px;
}

/* 采购弹窗内 select 强制原生样式（防原站JS/CSS覆盖为自定义组件） */
.proc-edit-select {
  appearance: auto !important;
  -webkit-appearance: menulist !important;
  -moz-appearance: menulist !important;
  background: var(--seed-surface, #fff) !important;
  border: 1px solid var(--seed-border, #ddd) !important;
  border-radius: 8px !important;
  padding: 6px 28px 6px 10px !important;
  height: 34px !important;
  font-size: 13px !important;
  color: var(--seed-fg, #333) !important;
  cursor: pointer !important;
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background-image: none !important;
}
