:root {
  --oakits-primary: #0d6efd;
  --oakits-sidebar-width: 260px;
  --oakits-topbar-height: 52px;
  --oakits-page-max: 1200px;
}

/* 移动优先：默认窄屏布局，PC 通过 min-width 扩展 */
body.oakits-app-body,
body.oakits-admin-body {
  min-height: 100vh;
  background: #f8f9fa;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.oakits-app-main,
.oakits-admin-content-inner {
  width: 100%;
  max-width: var(--oakits-page-max);
  margin-left: auto;
  margin-right: auto;
}

.oakits-app-navbar .navbar-brand {
  font-weight: 600;
}

.oakits-module-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  min-height: 120px;
}

.oakits-module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08);
}

/* —— 卡片列表（替代 table 列表）—— */
.oakits-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* 管理端主数据树（区划等）：单列嵌套，不用网格 */
.oakits-tree-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.oakits-tree-node > .oakits-record-card {
  margin-bottom: 0;
}

.oakits-tree-children {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.5rem 0 0 0.75rem;
  padding-left: 0.75rem;
  border-left: 2px solid #dee2e6;
}

/* jsTree（行政区划等） */
.oakits-jstree-wrap {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.75rem 0.5rem;
}

.oakits-jstree-wrap .jstree-default .jstree-node {
  margin-left: 16px;
}

.oakits-jstree-wrap .jstree-default .jstree-anchor {
  height: auto;
  min-height: 2rem;
  line-height: 1.5;
  padding: 0.25rem 0.35rem;
}

.oakits-jstree-wrap .jstree-default .jstree-wholerow {
  height: auto;
  min-height: 2rem;
}

.oakits-jstree-wrap .rg-tree-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.oakits-jstree-wrap .rg-tree-actions .btn {
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.3;
}

.oakits-record-card {
  border: 1px solid #dee2e6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.oakits-line-card.is-outsource {
  border-color: #ffc107;
  background: #fffdf5;
}

.oakits-line-card .badge-outsource {
  font-size: 0.7rem;
}

.sf-catalog-product-card .module-picks {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sf-catalog-product-card .module-pick-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.sf-catalog-product-card .module-pick-item:last-child {
  margin-bottom: 0;
}

.sf-catalog-product-card .module-line-amount {
  width: 7rem;
  flex-shrink: 0;
}

.oakits-line-card .module-picks {
  max-height: 220px;
  overflow-y: auto;
}

.oakits-line-card .module-pick-item:last-child {
  margin-bottom: 0 !important;
}

/* 系统备案表单：内置产品明细 / 外采明细分区标题与面板 */
.oakits-form-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #212529;
  margin: 0;
  padding: 0.4rem 0.75rem;
  background: #e7f1ff;
  border-left: 3px solid var(--oakits-primary);
  border-radius: 0.25rem;
  line-height: 1.4;
}

.oakits-form-section-title--optional {
  background: #fff8e8;
  border-left-color: #ffc107;
  color: #664d03;
}

.oakits-form-section-panel {
  background: #f0f4f8;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
}

.oakits-form-section-body {
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem 1rem;
  margin-bottom: 0;
}

.oakits-form-section-body--catalog {
  border-color: #b6d4fe;
  background: #f8fbff;
}

.oakits-form-section-body--outsource {
  border-color: #ffe69c;
  background: #fffdf5;
}

.oakits-card-dl {
  margin: 0;
}

.oakits-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #e9ecef;
  font-size: 0.875rem;
}

.oakits-card-row:last-child {
  border-bottom: none;
}

.oakits-card-row dt {
  color: #6c757d;
  font-weight: normal;
  margin: 0;
  flex-shrink: 0;
}

.oakits-card-row dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
  word-break: break-word;
}

.oakits-card-actions .btn {
  width: 100%;
}

.oakits-line-card .line-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* PC：列表卡片多列网格 */
@media (min-width: 768px) {
  .oakits-card-list-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .oakits-card-actions .btn {
    width: auto;
  }
}

@media (min-width: 1200px) {
  .oakits-card-list-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* —— 管理端：移动优先顶栏 + 抽屉 —— */
.oakits-admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.oakits-admin-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--oakits-topbar-height);
  background: #212529;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  gap: 0.5rem;
}

.oakits-admin-topbar .btn-menu {
  color: #fff;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
}

.oakits-admin-topbar-title {
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oakits-admin-topbar-user {
  max-width: 5.5rem;
}

.oakits-admin-offcanvas .offcanvas-body {
  background: #212529;
  padding: 0.75rem;
}

.oakits-admin-offcanvas .nav-link {
  color: rgba(255, 255, 255, 0.75);
  border-radius: 0.375rem;
  margin-bottom: 0.125rem;
  padding: 0.55rem 0.75rem;
}

.oakits-admin-offcanvas .nav-link:hover,
.oakits-admin-offcanvas .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.oakits-admin-main {
  flex: 1;
  background: #f8f9fa;
}

.oakits-page-header {
  background: #fff;
  border-bottom: 1px solid #dee2e6;
  padding: 0.75rem 1rem;
}

.oakits-admin-content {
  padding: 0.75rem;
}

/* PC 管理端：固定侧栏 */
@media (min-width: 992px) {
  .oakits-admin-shell.oakits-admin-desktop {
    flex-direction: row;
  }

  .oakits-admin-topbar {
    display: none;
  }

  .oakits-admin-sidebar-desktop {
    width: var(--oakits-sidebar-width);
    flex-shrink: 0;
    background: #212529;
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
  }

  .oakits-admin-sidebar-desktop .nav-link {
    color: rgba(255, 255, 255, 0.75);
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
    padding: 0.5rem 0.75rem;
  }

  .oakits-admin-sidebar-desktop .nav-link:hover,
  .oakits-admin-sidebar-desktop .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }

  .oakits-admin-main {
    flex: 1;
    min-width: 0;
  }

  .oakits-admin-content {
    padding: 1rem 1.25rem;
  }

  .oakits-page-header {
    padding: 1rem 1.25rem;
  }
}

/* —— 查询筛选（移动优先）—— */
.oakits-query-toolbar {
  gap: 0.5rem;
  align-items: stretch;
}

.oakits-query-toggle {
  padding: 0.5rem 0.75rem;
  line-height: 1.3;
  overflow: hidden;
}

.oakits-query-summary {
  display: block;
  font-size: 0.8125rem;
  color: #212529;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oakits-query-submit-short {
  flex-shrink: 0;
  min-width: 4.5rem;
  align-self: stretch;
}

.oakits-query-form .form-label {
  margin-bottom: 0.25rem;
  font-weight: 500;
}

/* 手机：全宽字段 + 更大触控区域（避免 iOS 输入框缩放） */
@media (max-width: 767.98px) {
  .oakits-query-form .form-control,
  .oakits-query-form .form-select {
    font-size: 16px;
    min-height: 44px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .oakits-query-form .form-select-sm,
  .oakits-query-form .form-control-sm {
    font-size: 16px;
    min-height: 44px;
  }

  .oakits-query-collapse.collapsing,
  .oakits-query-collapse.show {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #dee2e6;
  }

  .oakits-query-actions .btn {
    min-height: 44px;
  }

  .oakits-query-toolbar + .oakits-query-collapse .oakits-query-form .oakits-query-actions .btn-primary {
    display: none;
  }
}

/* PC：筛选区常显，隐藏移动端快捷查询钮 */
@media (min-width: 768px) {
  .oakits-query-collapse {
    display: block !important;
    height: auto !important;
    visibility: visible !important;
  }

  .oakits-query-form .form-control-sm,
  .oakits-query-form .form-select-sm {
    font-size: 0.875rem;
    min-height: auto;
  }

  .oakits-query-actions {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
  }
}

/* 表单明细行：移动端卡片，PC 可并排 */
.oakits-line-card .row.g-2 > [class*='col-'] {
  margin-bottom: 0.25rem;
}

@media (max-width: 767.98px) {
  .oakits-admin-filter-bar {
    flex-direction: column;
  }

  .oakits-admin-filter-bar .form-select,
  .oakits-admin-filter-bar .form-control,
  .oakits-admin-filter-bar .btn {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }
}

/* —— 多端认证入口与认证日志 —— */
.oakits-auth-log {
  margin: 0;
  padding: 0;
}

.oakits-auth-step {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px dashed #e9ecef;
}

.oakits-auth-step:last-child {
  border-bottom: none;
}

.oakits-auth-icon {
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  font-weight: 700;
  line-height: 1.4;
}

.oakits-auth-step-body {
  flex: 1;
  min-width: 0;
}

.oakits-auth-raw {
  max-height: 160px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.oakits-entry-card {
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.oakits-entry-card:hover {
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}
