.securityPage {
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  width: 100%;

  :global {
    .qwenpaw-tabs-nav {
      padding: 0 16px !important;
    }
  }
}

/* ---- Page Header (breadcrumb style) ---- */

.pageHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  padding: 20px;
  flex-shrink: 0;
  border-bottom: 1px solid #eae9e7;
}

.breadcrumbHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  flex: 1;
}

.breadcrumbParent {
  color: #999;
  font-weight: 400;
}

.breadcrumbSeparator {
  color: #ccc;
  margin: 0 4px;
}

.breadcrumbCurrent {
  color: #333;
  font-weight: 600;
  font-size: 20px;
}

/* ---- Header Section (deprecated, kept for dark-mode dark-mode coverage) ---- */
.header {
  margin-bottom: 20px;
}

.title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: #1a1a1a;
}

.description {
  font-size: 14px;
  color: #999;
  margin: 0;
}

:global(.dark-mode) {
  .pageHeader {
    border-bottom-color: rgba(255, 255, 255, 0.12);
  }

  .breadcrumbParent {
    color: rgba(255, 255, 255, 0.35);
  }

  .breadcrumbSeparator {
    color: rgba(255, 255, 255, 0.2);
  }

  .breadcrumbCurrent {
    color: rgba(255, 255, 255, 0.85);
  }

  .title {
    color: rgba(255, 255, 255, 0.9);
  }

  .description {
    color: rgba(255, 255, 255, 0.45);
  }
}

/* ---- Content Container ---- */
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
  padding: 0 16px;
}

/* ---- Main Tabs (Tool Guard / Skill Scanner) ---- */
.mainTabs {
  :global(.qwenpaw-tabs-nav) {
    margin-bottom: 20px;

    &::before {
      border-bottom: 1px solid #f0f0f0;
    }
  }

  :global(.qwenpaw-tabs-tab) {
    padding: 10px 4px;
    font-size: 14px;
    font-weight: 500;
    color: #666 !important;

    &:hover {
      color: #ff7f16 !important;
    }
  }

  :global(.qwenpaw-tabs-tab-active .qwenpaw-tabs-tab-btn) {
    color: #ff7f16 !important;
    font-weight: 600;
  }

  :global(.qwenpaw-tabs-ink-bar) {
    background: #ff7f16 !important;
    height: 3px;
    border-radius: 2px 2px 0 0;
  }
}

:global(.dark-mode) {
  .mainTabs {
    :global(.qwenpaw-tabs-tab .qwenpaw-tabs-tab-btn) {
      color: #ffffff !important;
    }

    :global(.qwenpaw-tabs-tab-active .qwenpaw-tabs-tab-btn) {
      color: #ff7f16 !important;
      font-weight: 600;
    }

    :global(.qwenpaw-tabs-ink-bar) {
      background: #ff7f16 !important;
    }
  }

  .innerTabs {
    :global(.qwenpaw-tabs-tab .qwenpaw-tabs-tab-btn) {
      color: #ffffff !important;
    }

    :global(.qwenpaw-tabs-tab-active .qwenpaw-tabs-tab-btn) {
      color: #ff7f16 !important;
    }

    :global(.qwenpaw-tabs-ink-bar) {
      background: #ff7f16 !important;
    }
  }

  .tabDescription {
    color: rgba(255, 255, 255, 0.45);
  }

  .footerButtons {
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .formCard,
  .tableCard {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;

    &:hover {
      border-color: rgba(255, 255, 255, 0.2);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
  }

  .tableCard {
    :global(.ant-table-thead > tr > th),
    :global(.qwenpaw-table-thead > tr > th) {
      background: rgba(255, 255, 255, 0.04) !important;
      color: rgba(255, 255, 255, 0.7) !important;
      border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    }

    :global(.ant-table-tbody > tr > td),
    :global(.qwenpaw-table-tbody > tr > td) {
      color: rgba(255, 255, 255, 0.75);
      border-bottom-color: rgba(255, 255, 255, 0.06);
    }

    :global(.ant-table-tbody > tr:hover > td),
    :global(.qwenpaw-table-tbody > tr:hover > td) {
      background: rgba(255, 255, 255, 0.06) !important;
    }
  }

  .form {
    :global {
      .ant-form-item-label > label {
        color: rgba(255, 255, 255, 0.85);
      }
    }
  }

  .skillScannerConfigItem + .skillScannerConfigItem {
    border-left-color: rgba(255, 255, 255, 0.1);
  }

  .skillScannerLabel {
    color: rgba(255, 255, 255, 0.85);
  }

  .sectionContainer {
    .tableCard {
      :global {
        .qwenpaw-table-wrapper
          .qwenpaw-table-container
          .qwenpaw-table-thead
          > tr
          > th {
          background: rgba(255, 255, 255, 0.04) !important;
          color: rgba(255, 255, 255, 0.7) !important;
        }
      }
    }
  }
}

.tabLabel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.tabContent {
}

.tabDescription {
  font-size: 14px;
  color: #888;
  margin: 0 0 20px 0;
  line-height: 1.6;
}

.sectionConfigureContainer {
  padding: 0 0 24px 0;
}

.sectionContainer {
  .sectionHeader {
    padding: 24px 0 0 0;
  }

  .tableCard {
    border: none !important;
    padding: 0 !important;

    :global {
      .qwenpaw-spark-card-wrapper {
        padding: 0 !important;
      }

      .qwenpaw-table-wrapper
        .qwenpaw-table-container
        .qwenpaw-table-thead
        > tr
        > th {
        background: #f9f8f4 !important;
      }
    }
  }
}

.sectionFileGuardContainer,
.sectionSkillScannerContainer {
  padding: 0;
}

/* ---- Inner Tabs (Scan Alerts / Whitelist) ---- */
.innerTabs {
  margin-top: 20px;

  :global(.qwenpaw-tabs-nav) {
    margin-bottom: 16px;

    &::before {
      border-bottom: 1px solid #f0f0f0;
    }
  }

  :global(.qwenpaw-tabs-tab) {
    font-size: 13px;
    font-weight: 500;
    color: #666 !important;

    &:hover {
      color: #ff7f16 !important;
    }
  }

  :global(.qwenpaw-tabs-tab-active .qwenpaw-tabs-tab-btn) {
    color: #ff7f16 !important;
  }

  :global(.qwenpaw-tabs-ink-bar) {
    background: #ff7f16 !important;
  }
}

.tabBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ff4d4f;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  margin-left: 6px;
  line-height: 18px;
}

.tabPanelContent {
  padding-top: 4px;
}

.tabPanelHeader {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* ---- Cards ---- */
.formCard {
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease-in-out;

  &:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: #d9d9d9;
  }

  :global(.ant-card-body) {
    padding: 20px 24px;
  }
}

.form {
  :global {
    .ant-form-item {
      margin-bottom: 20px;

      &:last-child {
        margin-bottom: 0;
      }
    }

    .ant-form-item-label > label {
      font-weight: 500;
      color: #333;
    }
  }
}

/* Tool Guard form row layout */
.toolGuardRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---- Section Header ---- */
.sectionHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 16px;
}

/* ---- Rule Table ---- */
.ruleTable {
  :global(.ant-table-thead > tr > th),
  :global(.qwenpaw-table-thead > tr > th),
  :global(.ant-table-tbody > tr > td),
  :global(.qwenpaw-table-tbody > tr > td) {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ---- Rule Collapse (category grouping) ---- */
.ruleCollapse {
  background: transparent;
  border: none;

  :global(.qwenpaw-collapse-item) {
    margin-bottom: 12px;
    border: 1px solid #e8e8e8;
    border-radius: 8px !important;
    overflow: hidden;
  }

  :global(.qwenpaw-collapse-header) {
    font-weight: 600;
    font-size: 14px;
    padding: 12px 16px !important;
    background: #fafafa;
  }

  :global(.qwenpaw-collapse-content-box) {
    padding: 0 !important;
  }
}

:global(.dark-mode) {
  .ruleCollapse {
    :global(.qwenpaw-collapse-item) {
      border-color: rgba(255, 255, 255, 0.1);
    }

    :global(.qwenpaw-collapse-header) {
      background: rgba(255, 255, 255, 0.04);
    }
  }
}

.collapseCategoryLabel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ---- Shell Evasion Checks ---- */
.shellEvasionSection {
  margin-top: 16px;
}

.shellEvasionGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.shellEvasionItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fafafa;
  transition: all 0.2s;

  &:hover {
    border-color: #d9d9d9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
}

.shellEvasionItemInfo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  margin-right: 12px;
}

.shellEvasionItemName {
  font-weight: 500;
  font-size: 13px;
  color: #333;
}

.shellEvasionItemDesc {
  font-size: 12px;
  color: #999;
  line-height: 1.4;
}

:global(.dark-mode) {
  .shellEvasionItem {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);

    &:hover {
      border-color: rgba(255, 255, 255, 0.2);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
  }

  .shellEvasionItemName {
    color: rgba(255, 255, 255, 0.85);
  }

  .shellEvasionItemDesc {
    color: rgba(255, 255, 255, 0.45);
  }
}

.sectionTitle {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: #1a1a1a;
}

:global(.dark-mode) .sectionTitle {
  color: rgba(255, 255, 255, 0.9);
}

/* ---- Table Card ---- */
.tableCard {
  margin-bottom: 0;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease-in-out;

  &:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: #d9d9d9;
  }

  :global(.ant-card-body) {
    padding: 0;
  }

  :global(.ant-table) {
    border-radius: 12px;
  }

  :global(.ant-table-thead > tr > th) {
    background: #fafafa;
    font-weight: 600;
    color: #333;
  }

  :global(.ant-table-tbody > tr:hover > td) {
    background: #f5f5f5;
  }
}

/* ---- Skill Scanner Config ---- */
.skillScannerConfig {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0;
}

.skillScannerConfigItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 24px;
}

.skillScannerConfigItem + .skillScannerConfigItem {
  padding-right: 0;
  border-left: 1px solid var(--ant-color-border, #f0f0f0);
}

.skillScannerLabel {
  font-weight: 500;
  flex-shrink: 0;
}

.emptyState {
  padding: 40px 24px;
  display: flex;
  justify-content: center;
}

.emptyText {
  color: #999;
}

:global(.dark-mode) .emptyText {
  color: rgba(255, 255, 255, 0.45);
}

.codeHash {
  font-size: 12px;
}

.footerButtons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 16px 24px;
  border-top: 1px solid #eae9e7;
  background: #fff;
  flex-shrink: 0;
}

:global(.dark-mode) {
  .footerButtons {
    background: #1f1f1f;
    border-top-color: rgba(255, 255, 255, 0.08);
  }
}

/* ---- Loading & Error States ---- */
.centerState {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  gap: 16px;
}

.stateText {
  font-size: 14px;
  color: #999;
}

.stateTextError {
  font-size: 14px;
  color: #ff4d4f;
}

/* ---- Host row (shield icon centering) ---- */

.hostRow {
  display: inline-flex;
  align-items: center;
}

/* ─── Mobile Adaptation ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .mainTabs {
    :global {
      .qwenpaw-tabs-nav {
        overflow-x: auto;
        scrollbar-width: none;

        &::-webkit-scrollbar {
          display: none;
        }
      }

      .qwenpaw-tabs-nav-wrap {
        overflow-x: auto !important;
        white-space: nowrap;
      }

      .qwenpaw-tabs-nav-list {
        display: inline-flex;
        white-space: nowrap;
      }

      .qwenpaw-tabs-tab {
        flex-shrink: 0;
        white-space: nowrap;
      }
    }
  }

  .content {
    padding: 0 12px;
  }

  .sectionConfigureContainer {
    padding-bottom: 16px;
  }

  .formCard {
    :global(.ant-card-body) {
      padding: 16px;
    }
  }

  .toolGuardRow {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .sectionHeader {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 12px 0;
  }

  .ruleTable,
  .tableCard {
    overflow-x: auto;

    :global(.ant-table),
    :global(.qwenpaw-table) {
      min-width: 600px;
    }
  }

  .ruleCollapse {
    :global(.qwenpaw-collapse-header) {
      padding: 10px 12px !important;
    }
  }

  .shellEvasionGrid {
    grid-template-columns: 1fr;
  }

  .skillScannerConfig {
    grid-template-columns: 1fr;
  }

  .skillScannerConfigItem {
    padding-right: 0;
  }

  .skillScannerConfigItem + .skillScannerConfigItem {
    border-left: none;
    border-top: 1px solid var(--ant-color-border, #f0f0f0);
    padding-top: 12px;
    margin-top: 12px;
  }

  .footerButtons {
    padding: 12px 16px;
  }
}
