/* The application route follows the dynamic browser viewport on every device. */
body.tac-page-apply .layout > .el-container {
  height: 100dvh !important;
}

/* Structure only: method 1 keeps both existing location selectors together. */
body.tac-page-apply .apply-location-methods {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  width: 100%;
}

/* Four clearly separated workflow sections, using the same neutral card frame
   already used by the permission summaries on the right. */
body.tac-page-apply .apply-step-card {
  margin-bottom: 14px;
  border: 1px solid var(--el-border-color-light, #ebeef5);
  border-radius: var(--el-border-radius-base, 4px);
  background: var(--el-bg-color, #fff);
  overflow: hidden;
}

body.tac-page-apply .apply-step-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--el-border-color-light, #ebeef5);
  font-weight: 600;
}

body.tac-page-apply .apply-step-card__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--el-color-primary, #409eff);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

body.tac-page-apply .apply-step-card__body {
  padding: 14px 14px 2px;
}

body.tac-page-apply .apply-step-card:nth-of-type(n + 2) > .apply-step-card__body > .el-form-item {
  display: block;
}

body.tac-page-apply .apply-step-card:nth-of-type(n + 2) > .apply-step-card__body > .el-form-item > .el-form-item__label {
  display: none;
}

body.tac-page-apply .apply-step-card:nth-of-type(n + 2) > .apply-step-card__body > .el-form-item > .el-form-item__content {
  width: 100%;
  margin-left: 0 !important;
}

/* There is no draft action: keep the sole submit action aligned to the form's
   left edge instead of reserving an empty label column. */
body.tac-page-apply .apply-step-card:nth-of-type(4) + .el-form-item > .el-form-item__content {
  margin-left: 0 !important;
}

/* Keep Element Plus tabs and behaviour, but present the four choices as four
   separate cards as in the approved layout. */
body.tac-page-apply .apply-step-card:nth-of-type(2) .el-tabs__nav-wrap::after {
  display: none;
}

body.tac-page-apply .apply-step-card:nth-of-type(2) .el-tabs__nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

body.tac-page-apply .apply-step-card:nth-of-type(2) .el-tabs__active-bar {
  display: none;
}

body.tac-page-apply .apply-step-card:nth-of-type(2) .el-tabs__item {
  justify-content: flex-start;
  height: 52px;
  padding: 0 12px !important;
  border: 1px solid var(--el-border-color, #dcdfe6);
  border-radius: var(--el-border-radius-base, 4px);
  line-height: 1.35;
  white-space: normal;
}

body.tac-page-apply .apply-step-card:nth-of-type(2) .el-tabs__item.is-active {
  border-color: var(--el-color-primary, #409eff);
  background: var(--el-color-primary-light-9, #ecf5ff);
}

@media (max-width: 767px) {
  body.tac-page-apply .apply-step-card {
    margin-bottom: 12px;
  }

  body.tac-page-apply .apply-step-card__header {
    min-height: 40px;
    padding: 0 12px;
  }

  body.tac-page-apply .apply-step-card__body {
    padding: 12px 10px 2px;
  }

  body.tac-page-apply .apply-step-card:nth-of-type(2) .el-tabs__nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  body.tac-page-apply .apply-step-card:nth-of-type(2) .el-tabs__item {
    height: 46px;
    padding: 0 8px !important;
    font-size: 12px;
  }

  body.tac-page-apply .apply-location-methods {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
}

/* Wide desktop: keep the form and both permission summaries inside that viewport. */
@media (min-width: 1367px) {
  body.tac-page-apply .main {
    overflow: hidden;
  }

  body.tac-page-apply .main > .el-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  body.tac-page-apply .main > .el-card > .el-card__header {
    flex: 0 0 auto;
  }

  body.tac-page-apply .main > .el-card > .el-card__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  body.tac-page-apply .main > .el-card > .el-card__body > div[style*="display: flex"] {
    height: 100%;
    min-height: 0;
  }

  body.tac-page-apply .main > .el-card form.el-form {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] {
    display: grid;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    height: 100%;
    min-height: 0;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] > .el-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 0 !important;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] > .el-card > .el-card__header {
    flex: 0 0 auto;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] > .el-card > .el-card__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] > .el-card > .el-card__body > div {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: none !important;
    overflow-y: auto;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] > .el-card[style*="margin-top"] > .el-card__body {
    display: flex;
    flex-direction: column;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] > .el-card[style*="margin-top"] > .el-card__body > div {
    flex: 1 1 auto;
    min-height: 0;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] > .el-card[style*="margin-top"] > .el-card__body > div > div:last-child {
    display: none !important;
  }

  body.tac-page-apply .main > .el-card form.el-form + div[style*="width: 400px"] > .el-card[style*="margin-top"] > .el-card__body::before {
    display: block;
    flex: 0 0 auto;
    width: max-content;
    max-width: 100%;
    min-height: 17px;
    margin-bottom: 8px;
    padding-right: 2px;
    background:
      radial-gradient(circle at 27px 8px, #67c23a 0 5px, transparent 5.5px),
      radial-gradient(circle at 132px 8px, #e6a23c 0 5px, transparent 5.5px);
    color: #909399;
    content: "绿色　=已有权限　　橙色　=缺少，点击加入";
    font-size: 11px;
    white-space: nowrap;
  }
}
