/* 北境云 Web 全站设计体系：标准后台，不依赖桌面无边框美学 */

:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e6ebf2;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0f766e;
  --primary-hover: #0d9488;
  --danger: #dc2626;
  --ok: #059669;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sidebar: 232px;
  --topbar: 56px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
a { color: var(--primary); }

/* 去掉桌面壳残留 */
.backdrop, .orb, .window-actions, .login-window-actions, .win-btn, .nav-slider { display: none !important; }
body, body * { -webkit-app-region: no-drag !important; app-region: no-drag !important; }

/* ===== 基础控件 ===== */
.input, input.input, select.input, textarea.input,
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="url"],
select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
}
textarea { min-height: 88px; resize: vertical; }
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: #99f6e4;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #eef2f7;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.btn:hover { filter: brightness(0.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: #fff; border-color: var(--line); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }

/* ===== 登录 ===== */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 15% 0%, rgba(15,118,110,.16), transparent 60%),
    radial-gradient(700px 380px at 100% 10%, rgba(37,99,235,.10), transparent 55%),
    var(--bg);
}
.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.auth-logo { width: 48px; height: 48px; border-radius: 12px; }
.auth-title { margin: 0; font-size: 22px; }
.auth-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.auth-form { display: grid; gap: 12px; }
.auth-field { display: grid; gap: 6px; color: #334155; }
.auth-error, .login-error { min-height: 18px; color: var(--danger); font-size: 13px; }
.auth-submit { width: 100%; min-height: 42px; }
.auth-foot { margin: 14px 0 0; text-align: center; color: #94a3b8; font-size: 12px; }

/* ===== 应用壳 ===== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}
.app-shell.is-sidebar-collapsed { grid-template-columns: 0 1fr; }
.app-shell.is-sidebar-collapsed .app-sidebar { overflow: hidden; padding: 0; border: 0; }

.app-sidebar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 10px;
  background: #0b1220;
  color: #e2e8f0;
}
.sidebar-brand { display: flex; gap: 10px; align-items: center; padding: 8px 10px 14px; }
.sidebar-brand img { width: 36px; height: 36px; border-radius: 10px; }
.sidebar-brand strong { display: block; font-size: 15px; }
.sidebar-brand span { color: #94a3b8; font-size: 12px; }
.sidebar-nav { display: grid; gap: 4px; flex: 1; align-content: start; }
.sidebar-link.nav-item, .nav-item.sidebar-link {
  width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: #cbd5e1; text-align: left; font-weight: 600; cursor: pointer;
}
.sidebar-link.nav-item:hover { background: rgba(148,163,184,.12); color: #fff; }
.sidebar-link.nav-item.is-active { background: var(--primary); color: #fff; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(148,163,184,.18); }
.sidebar-account-name { font-weight: 700; font-size: 13px; }
.sidebar-account-meta { margin-top: 2px; color: #94a3b8; font-size: 12px; }

.app-main { display: grid; grid-template-rows: var(--topbar) 1fr; min-width: 0; }
.app-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.page-title { margin: 0; font-size: 16px; font-weight: 700; }
.topbar-account-btn, .account-btn {
  min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
}
.account-menu { position: relative; }
.account-popover {
  position: absolute; right: 0; top: calc(100% + 8px); width: 240px;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); z-index: 50;
}
.account-popover-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 4px; font-size: 13px; color: var(--muted); }
.account-popover-row b { color: var(--text); font-weight: 700; }
.account-popover .btn { margin-top: 8px; }

.app-content { min-height: 0; overflow: auto; padding: 12px; }
.app-view.view { display: block; min-height: calc(100vh - var(--topbar) - 24px); }
.app-view.view[hidden] { display: none !important; }

/* ===== 通用面板 ===== */
.glass, .column.glass, .workflow-board.glass, .settings, .orders-page, .online-products-page, .selection-layout {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
.column-head, .settings-head, .online-head, .orders-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.column-title, .settings-title { font-weight: 700; }
.column-count { color: var(--muted); font-size: 12px; }
.column-head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.column-scroll { overflow: auto; }
.column-foot { padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-title { margin-top: 8px; color: var(--text); font-weight: 700; font-size: 15px; }
.empty-text { margin-top: 6px; font-size: 13px; }

/* ===== 采集箱 ===== */
.workbench {
  display: grid;
  grid-template-columns: minmax(320px, 42%) 1fr;
  gap: 12px;
  height: calc(100vh - var(--topbar) - 24px);
  min-height: 560px;
}
.workbench > .column {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.product-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.product-filters label, .filter-field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.product-table-wrap { overflow: auto; }
.product-table { width: 100%; border-collapse: collapse; }
.product-table th, .product-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; font-size: 13px;
}
.product-table th { position: sticky; top: 0; background: #f8fafc; z-index: 1; color: #475569; font-weight: 700; }
.product-row { cursor: pointer; }
.product-row:hover { background: #f8fafc; }
.product-row.is-active { background: #ecfdf5; }
.product-check-col, .product-check-cell { width: 36px; }
.product-info-cell { display: flex; gap: 10px; align-items: flex-start; }
.product-table-thumb img, .product-table-thumb {
  width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #f1f5f9; flex: 0 0 auto;
}
.product-thumb-empty {
  width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center;
  background: #f1f5f9; color: #94a3b8; font-size: 12px;
}
.product-title { font-weight: 650; line-height: 1.35; max-width: 360px; }
.product-info-meta { margin-top: 4px; color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.product-info-price { color: var(--primary); font-weight: 700; }
.product-old-price { text-decoration: line-through; color: #94a3b8; }
.product-pager { display: flex; gap: 10px; align-items: center; justify-content: center; }
.product-pager-meta { color: var(--muted); font-size: 12px; }
.product-change-line, .product-publish-log-item { display: block; font-size: 12px; color: #475569; }
.product-change-empty, .product-publish-log-empty { color: #94a3b8; font-size: 12px; }

/* 详情常见结构 */
#detailScroll { padding: 12px 14px 24px; }
.detail-section, .section-card, .detail-block, .panel-block {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 12px;
}
.detail-section-title, .section-title, .block-title {
  margin: 0 0 10px; font-size: 14px; font-weight: 700;
}
.form-grid, .detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.field, .form-field, label.field {
  display: grid; gap: 6px; font-size: 12px; color: var(--muted);
}
.field > span, .form-field > span { color: var(--muted); }

/* ===== 设置/店铺/用户 ===== */
.settings, .settings-inner { min-height: 100%; }
.settings-inner { padding: 14px; }
.settings-section, .shop-card, .user-card {
  margin-bottom: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.settings-section h3, .shop-card h3 { margin: 0 0 10px; font-size: 15px; }

/* ===== 选品 ===== */
.selection-layout { padding: 12px; display: grid; gap: 10px; }
.selection-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.selection-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}
.selection-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.selection-status { color: var(--muted); margin-right: auto; }
.selection-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.selection-table { width: 100%; border-collapse: collapse; }
.selection-table th, .selection-table td { padding: 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.selection-table th { background: #f8fafc; position: sticky; top: 0; }

/* ===== 工作台 ===== */
.workflow-board { min-height: calc(100vh - var(--topbar) - 24px); display: flex; flex-direction: column; }
.workflow-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.workflow-tab {
  min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; cursor: pointer; font-weight: 600; color: #475569;
}
.workflow-tab.is-active { background: #ecfdf5; border-color: #99f6e4; color: var(--primary); }
.workflow-list, .publish-log-list { padding: 12px; display: grid; gap: 10px; }
.workflow-item, .publish-log-item, .gap-row {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; padding: 12px;
}

/* ===== 在线商品/订单 ===== */
.online-products-page, .orders-page { padding: 12px; min-height: calc(100vh - var(--topbar) - 24px); }
.online-toolbar, .orders-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.online-table, .orders-table { width: 100%; border-collapse: collapse; }
.online-table th, .online-table td, .orders-table th, .orders-table td {
  padding: 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px;
}

/* ===== 浮层 ===== */
.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: grid; gap: 8px; }
.toast {
  min-width: 240px; max-width: 360px; padding: 12px 14px; border-radius: 12px;
  background: #0f172a; color: #fff; box-shadow: var(--shadow);
}
.lightbox {
  position: fixed; inset: 0; z-index: 1100; background: rgba(15,23,42,.72);
  display: grid; place-items: center; padding: 24px;
}
.lightbox img { max-width: min(96vw, 1100px); max-height: 90vh; border-radius: 12px; }
.selection-modal, .confirm-modal {
  position: fixed; inset: 0; z-index: 1200; background: rgba(15,23,42,.45);
  display: grid; place-items: center; padding: 16px;
}
.selection-modal[hidden], .confirm-modal[hidden], .lightbox[hidden] { display: none !important; }
.selection-modal-panel, .confirm-modal-panel {
  width: min(920px, 100%); max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.confirm-modal-panel { width: min(420px, 100%); padding: 18px; }
.selection-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.selection-modal-body { padding: 14px; }
.confirm-modal-title { font-weight: 700; font-size: 16px; }
.confirm-modal-text { margin: 10px 0 16px; color: var(--muted); }
.confirm-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* 状态色 */
.is-ok, .status-ok { color: var(--ok); }
.is-error, .status-error { color: var(--danger); }
.is-muted { color: var(--muted); }

@media (max-width: 1100px) {
  .workbench { grid-template-columns: 1fr; height: auto; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(80vw, 260px);
    transform: translateX(-105%); transition: transform .2s ease;
  }
  .app-shell.is-sidebar-open .app-sidebar { transform: translateX(0); }
}
